TypeError: randint(): argument 'size' (position 2) must be tuple of ints, not int

개발하는 G0·2023년 9월 6일
0
>>> torch.randint(5, (3,))

를 하면 결과가 정상적으로 출력되는데

tensor([2, 3, 4])

여기서 2번째 argument에서 comma를 지우면 에러가 난다.

>>> torch.randint(5, (3))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-a0f8b6b7bcd3> in <cell line: 1>()
----> 1 torch.randint(5, (3))

TypeError: randint(): argument 'size' (position 2) must be tuple of ints, not int

int의 tuple 형식으로 넣어야되고 int 자체를 넣지 말라고 한다.
토치...어려움....

profile
초보 개발자

0개의 댓글