Giter Site home page Giter Site logo

Multiple Inner Loops about functorch HOT 4 CLOSED

pytorch avatar pytorch commented on July 17, 2024
Multiple Inner Loops

from functorch.

Comments (4)

Chillee avatar Chillee commented on July 17, 2024

get_loss_for_task(x1, y1, x2, y2) gets you the loss for a single inner task (i.e. a single "inner loop", although it's only doing one step of the inner training loop here). This single inner task is (x1, y1, x2, y2), and consists of 2 examples pairs. So, let's say that x1 has shape[5].

So, if you vmap over get_loss_for_task, then you'd now pass in [B, 5] for x1 instead of just [5]. This corresponds to doing 5 runs of get_loss_for_task, or running 5 "inner training loops" in parallel.

from functorch.

pharringtonp19 avatar pharringtonp19 commented on July 17, 2024

@Chillee Thanks for the response, I should have been clearer in my original question.

As you note, "it's only doing one step of the inner training loop here". How would I adjust the code so that it does k steps instead of 1?

from functorch.

Chillee avatar Chillee commented on July 17, 2024

https://github.com/zou3519/functorch/blob/main/examples/maml_regression/evjang_transforms.py#L73

Instead of doing only one gradient step here, you need to pass in multiple examples and do multiple gradient steps in a loop.

from functorch.

pharringtonp19 avatar pharringtonp19 commented on July 17, 2024

@Chillee Thanks

from functorch.

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.