About 1,380,000 results
Open links in new tab
  1. What does -1 mean in numpy reshape? - Stack Overflow

    Sep 9, 2013 · b = numpy.reshape(a, -1) you are only saying for the numpy.reshape to automatically calculate the size of the vector (rows x columns) and relocate it into a 1-D vector with that dimension.

  2. python - Reshape an array in NumPy - Stack Overflow

    Jan 23, 2013 · 1 numpy has a great tool for this task ("numpy.reshape") link to reshape documentation

  3. How does numpy.reshape() with order = 'F' work? - Stack Overflow

    Aug 31, 2017 · From np.reshape docs You can think of reshaping as first raveling the array (using the given index order), then inserting the elements from the raveled array into the new array using the …

  4. python - How does numpy reshape works? - Stack Overflow

    Apr 2, 2015 · How does numpy reshape works? Asked 10 years, 8 months ago Modified 3 years, 1 month ago Viewed 12k times

  5. Convert a 1D array to a 2D array in numpy - Stack Overflow

    Sep 25, 2012 · Note that np.reshape also accepts an optional keyword order that lets you switch from row-major C order to column-major Fortran order. np.reshape is the function version of the a.reshape …

  6. What's the difference between `reshape()` and `view()` in PyTorch?

    Apr 4, 2018 · In numpy, we use ndarray.reshape() for reshaping an array. I noticed that in PyTorch, people use torch.view() for the same purpose, but at the same time, there is also a torch.reshape() …

  7. reshaping data in numpy with (-1,1). What does it mean?

    Sep 17, 2019 · reshaping data in numpy with (-1,1). What does it mean? Asked 6 years, 3 months ago Modified 6 years, 3 months ago Viewed 27k times

  8. python - Numpy reshape - copying data or not? - Stack Overflow

    Oct 5, 2021 · Reshape of original is a view: True #<- a, a.reshape share memory Transpose sharing memory: True #<- a, a.T share memory Reshape of transpose is a view: False #<- a.T, a.T.reshape …

  9. python - What does -1 in numpy reshape mean? - Stack Overflow

    Jan 21, 2017 · x = x.reshape(10, -1) internally what numpy does is just calculating 10000 / 10 to get the missing dimension. -1 can even be on the start of the array or in the middle. the above two examples …

  10. Reshape numpy (n,) vector to (n,1) vector - Stack Overflow

    Sep 17, 2016 · b_new = b.reshape((10, 1)) The amount of memory used should not differ at all between the 2 shapes. Numpy arrays use the concept of strides and so the dimensions (10,) and (10, 1) can …