111227
(宜良 洪)
1
I want to change this Keras function into PyTorch. Should I rewrite a new function or there is a function that Pytorch had already exist? Thanks
batch=input_shape.dim_size(0)
i_h=input_shape.dim_size(1)
i_w=input_shape.dim_size(2)
i_ch=input_shape.dim_size(3)
k_h=filter_shape.dim_size(0)
k_w=filter_shape.dim_size(1)
o_ch=filter_shape.dim_size(3)
Which function would you like to convert from Keras to PyTorch?
111227
(宜良 洪)
3
I want to find a function that has multiple inputs. For examples: my code has 4 inputs(batch, input height, input weight, and input channel)
I don’t want to redefine a lot of function, and trying to make my code easier to read.
Thanks for reply!
If you want to grab the dimension shapes, you could use:
size = my_tensor.size()
# or
N, C, H, W = my_tensor.size()
.shape
should also work.