nsf-ri-ubicv / sthor

STHOR (S{ekyfsr,imple,patio} Temporal Hierarchical Object Representation"
Other
3 stars 1 forks source link

slm bug: ValueError: operands could not be broadcast together with shapes (32,32,200) (33,33,200) #10

Open npinto opened 12 years ago

npinto commented 12 years ago
import numpy as np
from sthor.model import slm

slm.SequentialLayeredModel((512, 512), desc).process(np.random.randn(512, 512).astype('f'), interleave_stride=True)

desc = \
[[('fbcorr',
   {'initialize': {'filter_shape': (5, 5),
                   'generate': ('random:uniform', {'rseed': 42}),
                   'n_filters': 48},
    'kwargs': {'max_out': None, 'min_out': 0}}),
  ('lpool', {'kwargs': {'ker_shape': [2, 2], 'order': 10, 'stride': 2}})],
 [('fbcorr',
   {'initialize': {'filter_shape': (4, 4),
                   'generate': ('random:uniform', {'rseed': 42}),
                   'n_filters': 48},
    'kwargs': {'max_out': None, 'min_out': 0}}),
  ('lpool', {'kwargs': {'ker_shape': [2, 2], 'order': 10, 'stride': 2}})],
 [('fbcorr',
   {'initialize': {'filter_shape': (4, 4),
                   'generate': ('random:uniform', {'rseed': 42}),
                   'n_filters': 48},
    'kwargs': {'max_out': None, 'min_out': 0}}),
  ('lpool', {'kwargs': {'ker_shape': [2, 2], 'order': 10, 'stride': 2}})],
 [('fbcorr',
   {'initialize': {'filter_shape': (4, 4),
                   'generate': ('random:uniform', {'rseed': 42}),
                   'n_filters': 48},
    'kwargs': {'max_out': None, 'min_out': 0}}),
  ('lpool', {'kwargs': {'ker_shape': [2, 2], 'order': 10, 'stride': 2}})],
 [('fbcorr',
   {'initialize': {'filter_shape': (3, 3),
                   'generate': ('random:uniform', {'rseed': 42}),
                   'n_filters': 200},
    'kwargs': {'max_out': None, 'min_out': 0}})]]

gives me

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/npinto/projects/connectomics-sandbox/connectomics/npinto_sandbox/slm_gusti.py in <module>()
----> 1 slm.SequentialLayeredModel((512, 512), desc).process(np.random.randn(512, 512).astype('f'), interleave_stride=True)

/home/npinto/projects/sthor/sthor/model/slm.pyc in process(self, arr_in, pad_apron, interleave_stride)
    102         warnings.warn("process(...) is deprecated, please use transform(...)",
    103                       DeprecationWarning, stacklevel=2)
--> 104         return self.transform(arr_in, pad_apron=pad_apron, interleave_stride=interleave_stride)
    105 
    106 

/home/npinto/projects/sthor/sthor/model/slm.pyc in transform(self, arr_in, pad_apron, interleave_stride)
    204                     stride_w = Xc[0, 1] - Xc[0, 0]
    205 
--> 206                     arr_out[anchor_h::stride_h, anchor_w::stride_w, ...] = arr
    207                     X_int[anchor_h::stride_h, anchor_w::stride_w] = Xc
    208                     Y_int[anchor_h::stride_h, anchor_w::stride_w] = Yc

ValueError: operands could not be broadcast together with shapes (26,26,200) (27,27,200)
poilvert commented 12 years ago

should be solved in PR # 11 https://github.com/nsf-ri-ubicv/sthor/pull/11