reshape
1 | a.reshape(2,4) |
resize
1 | a.resize(2,4) |
transpose
1 | b = a.transpose(1,0,2) |
concatenate
1 | from numpy import * |
hstack
1 | from numpy import * |
vstack
1 | from numpy import * |
dtype
1 | x_train = np.array([], dtype=np.float32) |
unsqueeze
1 | test_x = Variable(torch.unsqueeze(test_data.test_data, dim=1), volatile=True).type(torch.FloatTensor)[:2000]/255. # shape from (2000, 28, 28) to (2000, 1, 28, 28), value in range(0,1) |
zeros
1 | np.zeros([20, 18]) |
a[np.newaxis, :]
np.tile(a, [2,2])
np.append()
1 |
|