Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize VISTA3D #8123

Merged
merged 5 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
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: 3 additions & 1 deletion monai/networks/nets/segresnet_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,10 @@ def forward( # type: ignore

outputs: list[torch.Tensor] = []
outputs_auto: list[torch.Tensor] = []
x_ = x.clone()
x_ = x
if with_point:
if with_label:
x_ = x.clone()
yiheng-wang-nv marked this conversation as resolved.
Show resolved Hide resolved
i = 0
for level in self.up_layers:
x = level["upsample"](x)
Expand Down
8 changes: 3 additions & 5 deletions monai/networks/nets/vista3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,10 @@ def forward(self, src: torch.Tensor, class_vector: torch.Tensor):
if self.use_mlp:
class_embedding = self.mlp(class_embedding)
# [b,1,feat] @ [1,feat,dim], batch dimension become class_embedding batch dimension.
masks = []
for i in range(b):
mask = class_embedding @ src[[i]].view(1, c, h * w * d)
masks.append(mask.view(-1, 1, h, w, d))
masks_embedding = class_embedding.squeeze() @ src.view(b, c, h * w * d)
masks_embedding = masks_embedding.view(b, -1, h, w, d).transpose(0, 1)

return torch.cat(masks, 1), class_embedding
return masks_embedding, class_embedding


class TwoWayTransformer(nn.Module):
Expand Down
Loading