-
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 GPU backend tests #1357
Conversation
779d60a
to
5c179a1
Compare
I reviewed @DropD 's changes. Did you review mine? |
if hasattr(value, "__array__") or hasattr(value, "__getitem__"): | ||
raise ValueError( | ||
"`ConstInitializer` can not be used with non-scalars. Use `Case.as_field` instead." | ||
) |
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.
if hasattr(value, "__array__") or hasattr(value, "__getitem__"): | |
raise ValueError( | |
"`ConstInitializer` can not be used with non-scalars. Use `Case.as_field` instead." | |
) | |
if not core_defs.is_scalar_type(value): | |
raise ValueError( | |
"`ConstInitializer` can not be used with non-scalars. Use `Case.as_field` instead." | |
) |
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 changed that...
class ConstInitializer(DataInitializer): | ||
"""Initialize with a given value across the coordinate space.""" | ||
|
||
value: ScalarValue | ||
|
||
def __init__(self, value: ScalarValue): |
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.
def __init__(self, value: ScalarValue): | |
def __init__(self, value: core_defs.Scalar): |
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.
and remove ScalarValue
completely
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.
... but kept ScalarValue
pointing to core_defs.Scalar
as this seems to be the pattern that is used in this field
mask = cases.allocate(cartesian_case, conditional_nested_tuple, "mask").strategy( | ||
cases.ConstInitializer(bool_field) | ||
)() | ||
mask = cartesian_case.as_field([IDim], np.random.choice(a=[False, True], size=size)) |
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.
could we built in to cases that boolean fields are allocated with alternating values by default?
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.
maybe in a follow-up PR to get the GPU support in
will merge now as no one complained about my last changes... |
No description provided.