RuntimeError: view size is not compatible with input tensor's size and stride ~
·
Error Note
- 전체 에러 문구 RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead. expand(), view(), transpose() 등의 함수를 이용해 텐서의 모양을 바꿀 때 새로운 텐서를 생성하는 것이 아니라, 저장된 메모리의 주소는 그대로 둔체 텐서의 모양만 바꾸게 됩니다. 이런 경우 메모리 주소가 연속적이지 않게 변하게되므로 발생하는 에러입니다. - 해결 방법 연속적이지 않은 메모리 주소를 연속적이게 만들어주면 됩니다. 1) contiguous() ..