Related to: Machine Learning

numpy.ndarray.view와 numpy.ndarray.reshape의 차이

  • view는 항상 같은 메모리임을 보장, reshape의 경우 항상 같은 메모리임을 보장하지 않음

    • view는 contiguity를 보장하지만 reshape는 보장하지 않음

    Returns a tensor with the same data and number of elements as input, but with the specified shape. When possible, the returned tensor will be a view of input. Otherwise, it will be a copy. Contiguous inputs and inputs with compatible strides can be reshaped without copying, but you should not depend on the copying vs. viewing behavior.

참조

https://stackoverflow.com/questions/49643225/whats-the-difference-between-reshape-and-view-in-pytorch

Week 2