Timeline for How can I reshape (16,) and (3,112,112) shape to the single (16,3,112,112)? See code below
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 17, 2021 at 10:34 | review | Close votes | |||
Aug 28, 2021 at 3:36 | |||||
Aug 9, 2021 at 7:50 | comment | added | Tariq Hussain | Okay, Okay, I got you. | |
Aug 9, 2021 at 7:50 | comment | added | Oxbowerce |
Like I said, use the numpy.stack equivalent for the library you are working with, which would be tf.stack for tensorflow and torch.stack for pytorch.
|
|
Aug 9, 2021 at 7:37 | comment | added | Tariq Hussain | the each image is in tensor format and then the all images together are in list. I know this, but how can I make it all for tensor only so that I can only read it as [16,3,112,112]? | |
Aug 9, 2021 at 7:34 | comment | added | Oxbowerce |
That is because you are appending tensors to a list, and since they are two different types at the top level the array is of shape (16,) whereas within each item the shape is (3, 112, 112) . Instead of appending to the list you should use numpy.stack , or given that you are working with tensors, use the tensorflow/pytorch equivalent.
|
|
Aug 9, 2021 at 7:31 | history | asked | Tariq Hussain | CC BY-SA 4.0 |