Exemple #1
0
 def unprepare(data, shape):
     """
     Inverses the manipulations in prepare().
     :param data: numpy.ndarray
     :param shape: The original shape of collapsed dimensions returned as
     a second item of the tuple from prepare().
     :return numpy.ndarray
     """
     return reshape(transpose(data), (data.shape[1], ) + shape)
Exemple #2
0
 def unprepare(data, shape):
     """
     Inverses the manipulations in prepare().
     :param data: numpy.ndarray
     :param shape: The original shape of collapsed dimensions returned as
     a second item of the tuple from prepare().
     :return numpy.ndarray
     """
     return reshape(transpose(data), (data.shape[1],) + shape)
Exemple #3
0
 def prepare(data):
     """
     Manipulates with the array's shape, collapsing all the dimensions but
     the first and transposing the resulting 2D matrix.
     :param data: numpy.ndarray
     :return tuple (the reshaped and transposed data,
     the original shape of collapsed dimensions)
     """
     shape = data.shape[1:]
     old_data = data
     new_data = transpose(
         reshape(data, (data.shape[0], data.size // data.shape[0])))
     assert_addr(old_data, new_data)
     return new_data, shape
Exemple #4
0
 def prepare(data):
     """
     Manipulates with the array's shape, collapsing all the dimensions but
     the first and transposing the resulting 2D matrix.
     :param data: numpy.ndarray
     :return tuple (the reshaped and transposed data,
     the original shape of collapsed dimensions)
     """
     shape = data.shape[1:]
     old_data = data
     new_data = transpose(reshape(data, (data.shape[0],
                                         data.size // data.shape[0])))
     assert_addr(old_data, new_data)
     return new_data, shape
Exemple #5
0
 def matrix(self):
     return reshape(self.mem, (self.shape[0], self.sample_size))
Exemple #6
0
 def matrix(self):
     return reshape(self.mem, (self.shape[0], self.sample_size))