Giter Club home page Giter Club logo

Comments (4)

CharlesShang avatar CharlesShang commented on September 13, 2024

Hi Dazhi,
Could you check if you are on the latest version?
I just run the code below, it works fine.

    # mdformable pooling (V2)
    dpooling = DCNPooling(spatial_scale=1.0 / 4,
                          pooled_size=7,
                          output_dim=32,
                          no_trans=False,
                          group_size=1,
                          trans_std=0.1,
                          deform_fc_dim=1024).cuda()

    # first
    for _ in range(10):
        dout = dpooling(input, rois)
        target = dout.new(*dout.size())
        target.data.uniform_(-0.1, 0.1)
        error = (target - dout).mean()
        error.backward()

from dcnv2.

chengdazhi avatar chengdazhi commented on September 13, 2024

Hi Charles, thanks for your reply. I have to use your code implemented for pytorch 0.4, and my problem was also triggered on pytorch 0.4.1.

I came up with an ugly but workable solution, which is to replace Function.save_for_backward and Function.saved_tensors with directly storing tensors as the Function objects' members. I have checked that this workaround produces correct results, but I'm not sure whether this would cause other problems.

from dcnv2.

CharlesShang avatar CharlesShang commented on September 13, 2024

I dont think save_for_backward is the reason to "buffers have already been freed" error.
I think you might call backward twice, like forward -> backward -> backward.

from dcnv2.

chengdazhi avatar chengdazhi commented on September 13, 2024

I am pretty positive that I didn't call two backwards consecutively. If you are not convinced about my conclusion, it should be very easy for you to switch to pytorch 0.4 implementation and add a loop to your example_mdpooling() in test.py. The error is triggered when calling _, _, ..., _ = self.saved_tensors, and it seems relative to your cuda code. I'm not familiar with pytorch, and I failed to pinpoint the root cause.

from dcnv2.

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.