Giter Site home page Giter Site logo

About "Native Implemention" about pacnet HOT 6 OPEN

nvlabs avatar nvlabs commented on July 16, 2024
About "Native Implemention"

from pacnet.

Comments (6)

suhangpro avatar suhangpro commented on July 16, 2024 2

The native implementation is using only standard pytorch layers/operations, while the other one uses the Function interface at places. The latter can have some memory advantage for larger input sizes.

from pacnet.

suhangpro avatar suhangpro commented on July 16, 2024 1

There shouldn't be any noticeable differences in speed. The non-native implementation has advantages in terms of peak memory usage, but I have no statistics regarding the gap. The native version was there mostly for debugging purposes, and the non-native version should be the preferred option now.

from pacnet.

Jerrypiglet avatar Jerrypiglet commented on July 16, 2024 1

Hey Hang, after a second thought, the original version is actually correct to me. kernel will be used when you compute grad_input, and input will be used when you compute grad_kernel. See the highlights below.
image

In your updated version I suppose you will see errors in https://github.com/NVlabs/pacnet/blob/master/pac.py#L352 that input is None when ctx.needs_input_grad[0] == False and ctx.needs_input_grad[0] == True. Am I right?

from pacnet.

Jerrypiglet avatar Jerrypiglet commented on July 16, 2024

Hey Hang, thanks for the comment! Additionally I am wondering if you have any statistics on how big the performance gap is between native and functional implementations, especially in case of large input sizes, or any differences in backprop speed, because I did some basic benchmarking and did not find significant difference there. Thanks!

from pacnet.

Jerrypiglet avatar Jerrypiglet commented on July 16, 2024

Ah i see. Thanks! The native version would also be useful for prototyping because it is easier to build upon.

from pacnet.

suhangpro avatar suhangpro commented on July 16, 2024

@Jerrypiglet That's right. I wasn't careful enough on this. The change is now reverted.

from pacnet.

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.