Giter Site home page Giter Site logo

Comments (4)

btgraham avatar btgraham commented on June 27, 2024

I have added an standalone ReLU function.
Regards
Ben

from sparseconvnet.

HeyangQin avatar HeyangQin commented on June 27, 2024

Using self.spatial_size= self.sparseModel.input_spatial_size(torch.LongTensor([1, 1])) with scn.ReLU() seems to cause torch.nn.modules.module.ModuleAttributeError: 'ReLU' object has no attribute 'input_spatial_size' Error.

from sparseconvnet.

btgraham avatar btgraham commented on June 27, 2024

Update pushed, thanks.

from sparseconvnet.

aradhyamathur avatar aradhyamathur commented on June 27, 2024

I implemented a custom print layer to print the shape of the output. I also received the above error. The following is the implementation.

class PrintLayer(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x ):
        print(x.shape)
        return x


model = scn.Sequential().add(
    scn.SubmanifoldConvolution(3, 24, 32, 3, False)
).add(
    PrintLayer()
).add(
    scn.BatchNormReLU(32)
).to(device)

Upon initialising as shown in the example leads to

inputSpatialSize = model.input_spatial_size(torch.LongTensor([512, 512, 512]))


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-58-2f931c1817d2> in <module>
----> 1 inputSpatialSize = model.input_spatial_size(torch.LongTensor([512, 512, 512]))

~/anaconda3/envs/sparse_conv/lib/python3.6/site-packages/sparseconvnet-0.2-py3.6-linux-x86_64.egg/sparseconvnet/sequential.py in input_spatial_size(self, out_size)
     11     def input_spatial_size(self, out_size):
     12         for m in reversed(self._modules):
---> 13             out_size = self._modules[m].input_spatial_size(out_size)
     14         return out_size
     15 

~/anaconda3/envs/sparse_conv/lib/python3.6/site-packages/torch/nn/modules/module.py in __getattr__(self, name)
    574                 return modules[name]
    575         raise AttributeError("'{}' object has no attribute '{}'".format(
--> 576             type(self).__name__, name))
    577 
    578     def __setattr__(self, name, value):

AttributeError: 'PrintLayer' object has no attribute 'input_spatial_size'

Is this error related to the previous problem pointed out ?

from sparseconvnet.

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.