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

Using tensor.untyped_storage() in InvertibleCheckpoint class methods. #6926

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
6 changes: 3 additions & 3 deletions python/dgl/nn/pytorch/conv/grouprevres.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def forward(ctx, fn, fn_inverse, num_inputs, *inputs_and_weights):
outputs = ctx.fn(*x).detach_()

# clear memory of input node features
inputs[1].storage().resize_(0)
inputs[1].untyped_storage().resize_(0)

# store for backward pass
ctx.inputs = [inputs]
Expand Down Expand Up @@ -63,10 +63,10 @@ def backward(ctx, *grad_outputs):
*((inputs[0], outputs) + inputs[2:])
)
# clear memory of outputs
outputs.storage().resize_(0)
outputs.untyped_storage().resize_(0)

x = inputs[1]
x.storage().resize_(int(np.prod(x.size())))
x.untyped_storage().resize_(int(np.prod(x.size())))
x.set_(inputs_inverted)

# compute gradients
Expand Down