Giter Club home page Giter Club logo

pylissom's People

Contributors

hernanbari avatar rmatuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

vmarois

pylissom's Issues

Cortex class throw on instantiation

I'm unable to instantiate the Cortex class in either the notebooks or directly in Python.
For example, the following code:

from pylissom.nn.modules.lissom import *  
in_features = 25**2 
out_features = 5**2 
cortex = Cortex(in_features, out_features, radius=5, sigma=5)  

Results in the following warning and exception:

../aten/src/ATen/native/LegacyDefinitions.cpp:19: UserWarning: masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torch.bool instead.
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-87d510715ac0> in <module>
      1 in_features = 25**2
      2 out_features = 5**2
----> 3 cortex = Cortex(in_features, out_features, radius=5, sigma=5)

~/Library/Python/3.7/lib/python/site-packages/pylissom/nn/modules/lissom.py in __init__(self, in_features, out_features, radius, sigma)
     29         self.weight.data = normalize(
     30             apply_circular_mask_to_weights(self.weight.data,
---> 31                                            radius=radius))
     32 
     33     def __repr__(self):

~/Library/Python/3.7/lib/python/site-packages/pylissom/math.py in normalize(matrix, norm, axis)
     76     """
     77     matrix_norms = matrix.norm(p=norm, dim=axis)
---> 78     return matrix.div(matrix_norms.expand_as(matrix))

RuntimeError: The expanded size of the tensor (625) must match the existing size (25) at non-singleton dimension 1.  Target sizes: [25, 625].  Tensor sizes: [25]

Using Python 3.7.5 and PyTorch 1.3.1.
(on Mac OS X, using pip not conda; PyTorch already installed)

I'll also try on Ubuntu 18.04 later and post result.

(Potentially great library - I'd like to use it in larger ANN robotics AI architecture)

Deprecated warning due to non-BoolTensor mask in apply_circular_mask_to_weights()

When instantiating the Cortex class, the function apply_circular_mask_to_weights() does:

  tensor = circular_mask(matrix.size()[1], matrix.size()[0], radius, matrix.is_cuda)
  matrix.masked_fill_(tensor, 0)

However, in PyTorch 1.3.1 (and likely some previous versions), calling masked_fill_ with a tensor that isn't a BoolTensor is depreciated.

The warning can be eliminated by changing the line to:

matrix.masked_fill_(tensor.type(torch.BoolTensor), 0)

though a better solution would be to have all the mask functions (like circular_mask()) return BoolTensor instead.

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.