GithubHelp home page GithubHelp logo

Comments (5)

alexandrosstergiou avatar alexandrosstergiou commented on August 19, 2024

Hi @Tloops,

Can you share a minimal snippet of your code?
A quick solution would be to explicitly do .cuda() in the call.

from adapool.

Tloops avatar Tloops commented on August 19, 2024

Thanks for your reply!

I've tried adapool_cuda.forward_3d_edscw(input.contiguous().cuda(), kernel, stride, output, return_mask, mask) in idea.py, but I still get the same error above.

A minimal snippet of my code (the model part) is as follows:

import adapool_cuda
from adaPool import AdaPool3d

class CNN3D(nn.Module):
    def __init__(self, num_classes):
        super(CNN3D, self).__init__()
        self.cnn = nn.Sequential(
            BasicConv(1, 8, kernel_size=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1)),
            nn.MaxPool3d(kernel_size=(2, 2, 2), stride=(2, 2, 2), padding=(1, 0, 1)),
            BasicConv(8, 16, kernel_size=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1)),
            nn.MaxPool3d(kernel_size=(2, 2, 2), stride=(2, 2, 2), padding=(1, 0, 0)),
            BasicConv(16, 32, kernel_size=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1)),
            nn.MaxPool3d(kernel_size=(2, 2, 2), stride=(2, 2, 2), padding=(1, 0, 1)),
            BasicConv(32, 64, kernel_size=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1)),
            nn.MaxPool3d(kernel_size=(2, 2, 2), stride=(2, 2, 2), padding=(0, 0, 1)),
            BasicConv(64, 128, kernel_size=(3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1)),
            nn.MaxPool3d(kernel_size=(2, 2, 2), stride=(2, 2, 2), padding=(1, 1, 0)),
        )
        self.pool = AdaPool3d(kernel_size=(6,7,6), beta=torch.Tensor([[[0.5]]]))
        self.fc = nn.Linear(128, num_classes)
        self.softmax = nn.Softmax()
    
    def forward(self, x):
        x = self.cnn(x)
        x = self.pool(x)
        x = x.view(x.size(0), -1)
        x = self.fc(x)
        x = self.softmax(x)
        return x

from adapool.

alexandrosstergiou avatar alexandrosstergiou commented on August 19, 2024

You need the beta tensor to also be in cuda, i.e:

pool = AdaPool3d(kernel_size=(6,7,6), beta=torch.Tensor([[[0.5]]]).cuda())

from adapool.

Tloops avatar Tloops commented on August 19, 2024

You need the beta tensor to also be in cuda, i.e:

pool = AdaPool3d(kernel_size=(6,7,6), beta=torch.Tensor([[[0.5]]]).cuda())

I've tried it but I still get the same error above. Really strange... πŸ˜•

from adapool.

alexandrosstergiou avatar alexandrosstergiou commented on August 19, 2024

I used the script below on two different machines:

import torch
import adapool_cuda
from adaPool import AdaPool3d

pool = AdaPool3d(kernel_size=(6,7,6), beta=torch.Tensor([[[0.5]]]).cuda())
x = torch.rand(1,1,16,224,224).cuda()
out = pool(x)
print(out.shape)

Wasn't able to reproduce the error

from adapool.

Related Issues (14)

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.