-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat[next] Enable embedded field view in ffront_tests #1361
feat[next] Enable embedded field view in ffront_tests #1361
Conversation
@@ -705,13 +706,33 @@ def __call__( | |||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | |
self.as_program(arg_types, kwarg_types)( | |
*args, out, offset_provider=offset_provider, **kwargs | |
) | |
return out |
Just noticed this bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should field_operator as program return the out
param? Maybe yes...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say no as programs don't return anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
than it was correct, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the program does not return something, but the field operator which we are calling does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we return self.as_program()()
i.e. whatever program does which is currently nothing therefore still correct and in case (for whatever reason) program()
returns something, we will do the right thing implicitly.
tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_builtin_execution.py
Show resolved
Hide resolved
src/gt4py/next/ffront/fbuiltins.py
Outdated
) -> common.Field | core_defs.ScalarT: | ||
assert core_defs.is_scalar_type(lhs) | ||
assert core_defs.is_scalar_type(rhs) | ||
return BINARY_MATH_NUMBER_BUILTIN_TO_PYTHON_SCALAR_FUNCTION[name](lhs, rhs) # type: ignore[operator] # Cannot call function of unknown type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return BINARY_MATH_NUMBER_BUILTIN_TO_PYTHON_SCALAR_FUNCTION[name](lhs, rhs) # type: ignore[operator] # Cannot call function of unknown type | |
return getattr(np, name)(lhs, rhs) |
Works just fine for scalars and the dict (with the clumsy name) is not needed in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, that's not what it does. it maps to python builtins, but thanks to our clever naming, they have different name...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel I'm missing something obvious. np.minimum
is an extension of the functionality of min
, so I don't understand your first sentence. Unless my assumption is wrong our naming is indeed clever as we chose the numpy name for all builtins and not sometimes the python ones in case they exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah now, I get it, you want to do the scalar functions using numpy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Enables field view in ffront_tests
New exclusion markers for some cases
Adds the following features to embedded:
__ne__
and__eq__
to FieldTODOs: