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

Function is_tensor_node

backends/vulkan/utils.py:248–264  ·  view source on GitHub ↗

Returns true if the given node produces a tensor value, or a collection of tensor values

(node: Any)

Source from the content-addressed store, hash-verified

246
247
248def is_tensor_node(node: Any) -> bool:
249 """
250 Returns true if the given node produces a tensor value, or a collection of tensor values
251 """
252 if not isinstance(node, torch.fx.Node):
253 return False
254
255 if "val" not in node.meta:
256 return False
257
258 if isinstance(node.meta["val"], FakeTensor):
259 return True
260
261 if isinstance(node.meta["val"], list) or isinstance(node.meta["val"], tuple):
262 return all(isinstance(x, FakeTensor) for x in node.meta["val"])
263
264 return False
265
266
267def is_tensor_arg_node(node: Any) -> bool:

Callers 8

is_tensor_arg_nodeFunction · 0.85
num_tensor_arg_nodesFunction · 0.85
check_node_dtypesFunction · 0.85
op_contains_bool_tensorFunction · 0.85
within_buffer_limitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected