dont bake in defaults when tracing *_like factories (#97564)

quick fix for https://github.com/pytorch/pytorch/issues/97541. letting CI run to see if there's any fallout

Pull Request resolved: https://github.com/pytorch/pytorch/pull/97564
Approved by: https://github.com/ezyang
This commit is contained in:
Brian Hirsh
2023-03-27 15:08:41 +00:00
committed by PyTorch MergeBot
parent 2ca911f2ac
commit 35c9ea89fa
5 changed files with 18 additions and 10 deletions

View File

@ -815,9 +815,7 @@ def signature_from_schema(
type=OptionalType(BaseType(BaseTy.ScalarType)),
default="None",
default_init=(
"self.scalar_type()"
if is_like_or_new_function
else topt_default_init("dtype")
None if is_like_or_new_function else topt_default_init("dtype")
),
)
)
@ -827,9 +825,7 @@ def signature_from_schema(
type=OptionalType(BaseType(BaseTy.Layout)),
default="None",
default_init=(
"self.layout()"
if is_like_or_new_function
else topt_default_init("layout")
None if is_like_or_new_function else topt_default_init("layout")
),
)
)
@ -839,7 +835,7 @@ def signature_from_schema(
type=OptionalType(BaseType(BaseTy.Device)),
default="None",
default_init=(
"self.device()"
None
if is_like_or_new_function
else (
topt_default_init("device")