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
For `nonstrict_trace`-ed function, the only allowed input types are basic types (e.g., torch.Tensor, int, float) or pytree containers of those. Here you are calling the function with arguments that contain a value of type <DecoratorTests.test_nonstrict_trace_custom_class_error.<locals>.Point>, please use one of the following to register the type with pytree:
678
+
* `torch.utils._pytree.register_constant`
605
679
* `torch.utils._pytree.register_dataclass`
606
680
* `torch.utils._pytree.register_pytree_node`
607
681
"""# NOQA: B950
@@ -653,39 +727,104 @@ def fn(x, y):
653
727
excepttorch._dynamo.exc.Unsupportedase:
654
728
msg="""
655
729
For `nonstrict_trace`-ed function, the only allowed input types are basic types (e.g., torch.Tensor, int, float) or pytree containers of those. Here you are calling the function with arguments that contain a value of type <DecoratorTests.test_nonstrict_trace_nested_custom_class_error.<locals>.Point>, please use one of the following to register the type with pytree:
self.assertFalse(True) # must raise error before this
770
+
excepttorch._dynamo.exc.Unsupportedase:
771
+
msg="""
772
+
You are calling a `nonstrict_trace`-ed function with an input that contains an object of type <DecoratorTests.test_nonstrict_newly_constructed_trace_register_constant_type_error.<locals>.State>, which was marked with `pytree.register_constant`. However, the object was constructed _inside_ the `torch.compile` region.
773
+
774
+
Please construct the object _outside_ the `torch.compile` region, or submit an issue to GitHub.
self.assertFalse(True) # must raise error before this
686
818
excepttorch._dynamo.exc.Unsupportedase:
687
819
msg="""
688
-
This error is most likely due to a call to `nonstrict_trace`-ed function, where one of the argument contains object of a type that has been (or needs to be) `torch.utils._pytree.register_constant`-ed. We currently don't support that.
820
+
You are calling a `nonstrict_trace`-ed function where one one of the inputs has been registered with a `pytree_flatten` that puts an object of type <DecoratorTests.test_nonstrict_trace_object_in_context_error.<locals>.Point> into the context.
821
+
822
+
Please consider modifying that `pytree_flatten` to avoid putting the object into context, and apply one of the following to <DecoratorTests.test_nonstrict_trace_object_in_context_error.<locals>.Point>
823
+
* `torch.utils._pytree.register_constant`
824
+
* `torch.utils._pytree.register_dataclass`
825
+
* `torch.utils._pytree.register_pytree_node`
826
+
827
+
If the above doesn't work, please subtmit an issue to GitHub.
0 commit comments