Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
srush committed Sep 8, 2019
1 parent ccfa795 commit 8b5b9d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torch_struct/deptree.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class MySlice(Function):
def forward(ctx, input, e, a, b, c, d):
output = input.clone().zero_()
ctx.save_for_backward(output, torch.tensor([e, a, b, c, d]))
return input[e, :, a:b, c:d]
return input.data[e, :, a:b, c:d]

@staticmethod
def backward(ctx, grad_v):
output, a = ctx.saved_tensors
output[a[0], :, a[1]:a[2], a[3]:a[4]] = grad_v
output.data[a[0], :, a[1]:a[2], a[3]:a[4]] = grad_v
return output, None, None, None, None, None

class DepTree(_Struct):
Expand Down

0 comments on commit 8b5b9d9

Please sign in to comment.