MCPcopy Create free account
hub / github.com/pytorch/executorch / tensor_node_is_high_dim

Function tensor_node_is_high_dim

backends/vulkan/utils.py:718–729  ·  view source on GitHub ↗

Returns true if a given node contains a tensor with more than 4 dimensions

(node: torch.fx.Node)

Source from the content-addressed store, hash-verified

716
717
718def tensor_node_is_high_dim(node: torch.fx.Node) -> bool:
719 """
720 Returns true if a given node contains a tensor with more than 4 dimensions
721 """
722 if isinstance(node.meta["val"], FakeTensor):
723 return len(node.meta["val"].shape) > 4
724 if isinstance(node.meta["val"], list) or isinstance(node.meta["val"], tuple):
725 for fake_tensor in node.meta["val"]:
726 if isinstance(fake_tensor, FakeTensor):
727 if len(fake_tensor.shape) > 4:
728 return True
729 return False
730
731
732def required_image_extents(sizes: torch.Size, layout: VkMemoryLayout) -> ImageExtents:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected