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

Function to_list

exir/tensor.py:359–367  ·  view source on GitHub ↗
(
        x: Union[torch.Size, int, List[int], Tuple[int]]
    )

Source from the content-addressed store, hash-verified

357 """
358
359 def to_list(
360 x: Union[torch.Size, int, List[int], Tuple[int]]
361 ) -> Union[List[int], List[torch.Size]]:
362 if isinstance(x, torch.Size) or isinstance(x, tuple):
363 return list(x)
364 elif isinstance(x, int):
365 return [x]
366 else:
367 return x
368
369 tensor_size = to_list(spec.shape)
370 tensor_dim_order = to_list(spec.dim_order)

Callers 1

make_tensor_valueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected