Minor error: x.reshape(3, 4) works in pytorch but does not work in tensorflow. I am referring to this part:
" Note that specifying every shape component to
reshape is redundant. Because we already know our tensor’s size, we can work out one component of the shape given the rest. For example, given a tensor of size n and target shape (h, w), we know that w=n/h. To automatically infer one component of the shape, we can place a
-1 for the shape component that should be inferred automatically. In our case, instead of calling
x.reshape(3, 4) , we could have equivalently called
x.reshape(-1, 4) or
x.reshape(3, -1) ."