I have a layer that is forward-only and using .data
was the simplest way to implement is.
second_loss(func(x.data), y)
I could use no_grad
context, but that would have been not as elegant because I do want grad
for second_loss
, just not for func
.