Git Product home page Git Product logo

Comments (3)

soulitzer avatar soulitzer commented on July 18, 2024

I'm not sure if this is the intended behavior

This is expected behavior. Computing the jacobian with torch.autograd.functional.jacobian does not work with inference mode because it needs to record computation to the autograd graph underneath.

perhaps we can add a line in the documentation of inference mode about this behavior?

From the docs there is:

InferenceMode is a new context manager analogous to no_grad to be used when you are certain your operations will have no interactions with autograd

From https://pytorch.org/docs/stable/generated/torch.autograd.grad_mode.inference_mode.html

Does this line make things clearer?

from pytorch.

hchau630 avatar hchau630 commented on July 18, 2024

I see, yes that certainly makes things clearer. Maybe we can add something like that to the documentation at https://pytorch.org/docs/stable/notes/autograd.html#inference-mode? So maybe instead of

Enable inference mode when you are performing computations that don’t need to be recorded in the backward graph, AND you don’t plan on using the tensors created in inference mode in any computation that is to be recorded by autograd later.

we can write

Enable inference mode when you are performing computations that do not have interactions with autograd, AND you don’t plan on using the tensors created in inference mode in any computation that is to be recorded by autograd later.

from pytorch.

soulitzer avatar soulitzer commented on July 18, 2024

Sounds OK to me, thanks for the suggestion. Happy to accept a PR with that change.

from pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.