hernanbari / pylissom Goto Github PK
View Code? Open in Web Editor NEWPytorch extension implementing LISSOM network and Topographica features
Home Page: https://pylissom.readthedocs.io/
License: GNU General Public License v3.0
Pytorch extension implementing LISSOM network and Topographica features
Home Page: https://pylissom.readthedocs.io/
License: GNU General Public License v3.0
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.
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.