Torch.no_grad() for Java

What is the equivalent for doing torch.no_grad() in Java?
Like in C++ it is torch::NoGradGuard

Hi,

You mean on mobile? Or do you refer to another Java binding?
IIRC it does not support training, so it is running in no_grad all the time.

I mean running it on mobile.

@vishalagarwal
Java binding works for forward only and auto grad is disabled all the time.

Details:
It has torch::autograd::AutoGradMode g{false} before every forward operation.

2 Likes