You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pattern is very common and can be implemented generically.
The only times this will change is when we need to spoof our actual size, which is uncommon NJT is the only one I can think of
def_apply_fn_to_data(self, fn: Callable):
"""Applies a fn to all tensor components stored on this class"""tensor_names, ctx=self.__tensor_flatten__()
# Apply the function to each tensor componentnew_tensors= {}
fornameintensor_names:
new_tensors[name] =fn(getattr(self, name))
returnself.__class__.__tensor_unflatten__(
new_tensors,
ctx,
None, # outer_size parameterNone, # outer_stride parameter
)
The text was updated successfully, but these errors were encountered:
Summary
This pattern is very common and can be implemented generically.
The only times this will change is when we need to spoof our actual size, which is uncommon NJT is the only one I can think of
The text was updated successfully, but these errors were encountered: