Skip to content
Open
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
4 changes: 2 additions & 2 deletions utils3d/torch/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ def transform_points(x: Tensor, *Ts: Tensor) -> Tensor:
total_numel = sum(t.numel() for t in Ts) + x.numel()
if total_numel > 1000:
# Only use einsum when the total number of elements is large enough to benefit from optimized contraction path
operands = [*reversed(Ts), x[:, None]]
operands = [*reversed(Ts), x[..., None]]
offset = len(operands) + 1
batch_shape = torch.broadcast_shapes(*(m.shape[:-2] for m in operands))
batch_subscripts = tuple(range(offset, offset + len(batch_shape)))
Expand All @@ -1394,7 +1394,7 @@ def transform_points(x: Tensor, *Ts: Tensor) -> Tensor:
)
y = y.squeeze(-1)
else:
y = x[:, None]
y = x[..., None]
for T in Ts:
y = T @ y
y = y.squeeze(-1)
Expand Down