File tree Expand file tree Collapse file tree 1 file changed +9
-25
lines changed
userbenchmark/dynamo/dynamobench/_dynamo Expand file tree Collapse file tree 1 file changed +9
-25
lines changed Original file line number Diff line number Diff line change @@ -4495,38 +4495,22 @@ def does_not_override_dict_iter_methods(user_cls):
4495
4495
)
4496
4496
4497
4497
4498
- # Helper functions below are to prevent __torch_function__
4499
- # calls from happening in the middle of __torch_function__
4500
- # compiled bytecode
4501
- # They will be skipped which is the desired result
4498
+ # Helper functions below are to prevent TorchDynamo to prevent tracing of
4499
+ # __torch_function__ calls triggered on tensor properties in the pre graph
4500
+ # bytecode.
4501
+ @ torch . _disable_dynamo
4502
4502
def call_size (x , i ):
4503
- @torch ._dynamo .disable (
4504
- recursive = True , reason = "__torch_function__ tracing helper function"
4505
- )
4506
- def fn (x , i ):
4507
- return x .size (i )
4508
-
4509
- return fn (x , i )
4503
+ return x .size (i )
4510
4504
4511
4505
4506
+ @torch ._disable_dynamo
4512
4507
def call_stride (x , i ):
4513
- @torch ._dynamo .disable (
4514
- recursive = True , reason = "__torch_function__ tracing helper function"
4515
- )
4516
- def fn (x , i ):
4517
- return x .stride (i )
4518
-
4519
- return fn (x , i )
4508
+ return x .stride (i )
4520
4509
4521
4510
4511
+ @torch ._disable_dynamo
4522
4512
def call_storage_offset (x ):
4523
- @torch ._dynamo .disable (
4524
- recursive = True , reason = "__torch_function__ tracing helper function"
4525
- )
4526
- def fn (x ):
4527
- return x .storage_offset ()
4528
-
4529
- return fn (x )
4513
+ return x .storage_offset ()
4530
4514
4531
4515
4532
4516
# Helper function to extract relevant parts of a tensor's __dict__ to store in node meta.
You can’t perform that action at this time.
0 commit comments