Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion torch/_inductor/fx_passes/joint_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def insertable_tensor_check(self, t: torch.Tensor) -> bool:
# TODO - we could also Tensors which get replaced with arange here
return (
t.numel() != 0
and (t == t.flatten()[0]).all()
and bool((t == t.flatten()[0]).all())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT

Suggested change
and bool((t == t.flatten()[0]).all())
and (t == t.flatten()[0]).all().item()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, looks like the bool() would be necessary anyway as item() is typed as returning Union[bool, int, float, complex]. I guess ideally we'd have generics in our Tensor type...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool is pretty much the same as item() so I think it's alright as it is

and torch._C._has_storage(t)
and t.layout == torch.strided
)
Expand Down
2 changes: 1 addition & 1 deletion torch/_inductor/inductor_prims.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def meta(*args, **kwargs):
)


def eager_force_stride(input_tensor: Tensor, stride) -> tuple[int, ...]:
def eager_force_stride(input_tensor: Tensor, stride) -> Tensor:
if input_tensor.stride() == stride:
return input_tensor
new_tensor = input_tensor.clone().as_strided(
Expand Down
2 changes: 1 addition & 1 deletion torch/_inductor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,10 +873,10 @@ def use_aten_gemm_kernels():

class DebugDirManager:
counter = itertools.count(0)
prev_debug_name: str

def __init__(self):
self.id = next(DebugDirManager.counter)
self.prev_debug_name = None

def __enter__(self):
self.prev_debug_name = torch._dynamo.config.debug_dir_root
Expand Down