File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -332,12 +332,16 @@ def backend_impl(*args, **kwargs):
332
332
fn = self ._backend_fns [device_type ]
333
333
module = inspect .getmodule (fn )
334
334
raise RuntimeError (
335
- f"Tensors returned from custom ops (1) must not "
336
- f"be inputs to the custom op and (2) may not alias "
337
- f"any inputs or other returns. Please clone the "
338
- f"the offending output tensors (e.g. output.clone()) "
339
- f"or refactor your code. "
340
- f"Offending op: { self ._name } (with implementation in { module } )"
335
+ f"{ self ._name } (with implementation in { module } ): "
336
+ f"The output of this custom operator (1) must not "
337
+ f"also be an input to this custom operator and "
338
+ f"(2) may not alias any inputs to this custom operator "
339
+ f"or other returns. "
340
+ f"The most common way to trigger this error is if "
341
+ f"we have y = custom_op(x) and y and x are the same Tensor. "
342
+ f"Please instead return a clone of the offending output "
343
+ f"tensor(s) (e.g. return x.clone()) or refactor the custom "
344
+ f"operator to not return y."
341
345
)
342
346
storages .add (key )
343
347
return result
You can’t perform that action at this time.
0 commit comments