mirror of https://github.com/commaai/tinygrad.git
Permute examples (#731)
* examples: use permute instead of transpose * Use transpose but change args
This commit is contained in:
parent
39d6e1525f
commit
156640e90d
|
@ -72,7 +72,7 @@ class Conv3x3Biased:
|
|||
# Not outChannel,inChannel,Y,X.
|
||||
# Therefore, transpose it before assignment.
|
||||
# I have long since forgotten how I worked this out.
|
||||
self.weight.assign(Tensor(layer["weight"]).reshape(shape=self.weight.shape).transpose(order=(0, 1, 3, 2)))
|
||||
self.weight.assign(Tensor(layer["weight"]).reshape(shape=self.weight.shape).transpose(2, 3))
|
||||
self.bias.assign(Tensor(layer["bias"]).reshape(shape=self.bias.shape))
|
||||
|
||||
class Vgg7:
|
||||
|
|
|
@ -174,8 +174,7 @@ def predict_transform(prediction, inp_dim, anchors, num_classes):
|
|||
bbox_attrs = 5 + num_classes
|
||||
num_anchors = len(anchors)
|
||||
prediction = prediction.reshape(shape=(batch_size, bbox_attrs*num_anchors, grid_size*grid_size))
|
||||
# Original PyTorch: transpose(1, 2) -> For some reason numpy.transpose order has to be reversed?
|
||||
prediction = prediction.transpose(order=(0,2,1))
|
||||
prediction = prediction.transpose(1, 2)
|
||||
prediction = prediction.reshape(shape=(batch_size, grid_size*grid_size*num_anchors, bbox_attrs))
|
||||
prediction_cpu = prediction.cpu().numpy()
|
||||
for i in (0, 1, 4):
|
||||
|
|
Loading…
Reference in New Issue