Exemplo n.º 1
0
 def _allocate(self):
     self.order = check_valid_permutation(self.order)
     if self.input_dim != len(self.order):
         raise ValueError("input_dim does not match length of order "
                          "vector")
     # No roles assigned here, since these are not learnable parameters.
     if self._dot:
         shape = (self.order.shape[0], self.order.shape[0])
         self._matrix = shared_floatx(
             PermutationMatrix(self.order).generate(None, shape))
     else:
         order = self.order.astype('int32')
         assert order.min() == 0  # Catch highly unlikely downcast issue.
         self._permutation = shared(order)
Exemplo n.º 2
0
 def __init__(self, permutation=None):
     if permutation is not None:
         permutation = check_valid_permutation(permutation)
     self.permutation = permutation