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: 3 additions & 1 deletion distconv/distconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,9 @@ class _ToTensor(Function):
@staticmethod
def forward(ctx, dc_tensor: DCTensor):
ctx.parallel_strategy = dc_tensor._parallel_strategy
return dc_tensor._tensor
# Need to alias the tensor to prevent the returned inner tensor from
# creating circular references when its grad_fn gets modified
return torch.Tensor(dc_tensor._tensor)

@staticmethod
def backward(ctx, grad: torch.Tensor):
Expand Down