MCPcopy Create free account
hub / github.com/apache/singa / transpose

Method transpose

examples/model_selection/Trails/singa_pkg_code/tensor.py:190–210  ·  view source on GitHub ↗

To transpose the tensor Args: axes: axes to transpose Returns: new transposed tensor

(self, axes=None)

Source from the content-addressed store, hash-verified

188 return self.data.transpose()
189
190 def transpose(self, axes=None):
191 ''' To transpose the tensor
192
193 Args:
194 axes: axes to transpose
195
196 Returns:
197 new transposed tensor
198 '''
199 t = Tensor(self.shape, self.device, self.dtype)
200 if axes is None:
201 tshape = [self.shape[x] for x in range(len(t.shape))]
202 t.shape = tuple(tshape)
203 t.data = singa.DefaultTranspose(self.data)
204 else:
205 if (len(axes) != len(self.shape)):
206 raise ValueError('dimensions do not match')
207 tshape = [self.shape[x] for x in axes]
208 t.shape = tuple(tshape)
209 t.data = singa.Transpose(self.data, list(axes))
210 return t
211
212 def size(self): # TODO(wangwei) compute size
213 '''

Callers 14

is_transposeMethod · 0.45
transposeFunction · 0.45
load_train_dataFunction · 0.45
load_test_dataFunction · 0.45
forwardMethod · 0.45
load_dataFunction · 0.45
load_train_dataFunction · 0.45
load_test_dataFunction · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
merge_weightsMethod · 0.45

Calls 2

TensorClass · 0.70
tupleFunction · 0.50

Tested by

no test coverage detected