Skip to content

Commit 606b3ed

Browse files
Skip inferring tensor shapes in TB of modules that do not match simple x (single input) spec (e.g. MHA is skipped).
1 parent 30f8d95 commit 606b3ed

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/eir/models/tensor_broker/tensor_broker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def hook(
100100
if isinstance(v, torch.Tensor):
101101
output_shapes[f"{layer_path}.{k}"] = v.shape[1:]
102102

103+
input_tensor: torch.Tensor | dict[str, torch.Tensor] | None = None
103104
if len(args) > 0:
104105
input_tensor = args[0]
105106
else:
@@ -109,8 +110,6 @@ def hook(
109110
input_tensor = x
110111
elif input_key is not None:
111112
input_tensor = input_key
112-
else:
113-
raise ValueError("No input tensor found in args or kwargs.")
114113

115114
if isinstance(input_tensor, torch.Tensor):
116115
input_shapes[layer_path] = input_tensor.shape[1:]

0 commit comments

Comments
 (0)