RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

2023. 6. 20. 17:54·Error
728x90

torchsummary로 pytorch의 모델의 구조를 확인하려할때 위와 같은 에러가 발생하였다.

모델이나 data가 GPU에 올라가있지 않아서 발생하는 에러라고 한다.

# dataset을 GPU에 올릴 때
torch.tensor(..., device="cuda") 
torch.tensor(...).cuda() 
torch.tensor(...).to("cuda")

# model을 GPU에 올릴 때
model.to("cuda")
728x90

'Error' 카테고리의 다른 글

[Python] TypeError: sequence item 0: expected str instance, int found  (0) 2024.09.04
support for password authentication was removed on ~  (0) 2023.04.20
ModuleNotFoundError: No module named 'cv2'  (0) 2023.04.11
No module named 'torch'  (0) 2023.04.11
Cannot find debug adapter for type 'python'  (0) 2023.02.13
'Error' 카테고리의 다른 글
  • [Python] TypeError: sequence item 0: expected str instance, int found
  • support for password authentication was removed on ~
  • ModuleNotFoundError: No module named 'cv2'
  • No module named 'torch'
bbooo
bbooo
  • bbooo
    bbooo
    bbooo
  • 전체
    오늘
    어제
    • 분류 전체보기 (142)
      • study (61)
        • 백준(BOJ) (34)
        • Programmers (15)
        • LeetCode (9)
      • AI (4)
        • Paper (0)
      • SSAC X IFFEL (4)
        • DeepML (1)
        • 밑바닥 부터 시작하는 딥러닝 (2)
      • 회고 (46)
      • Error (10)
      • Setting (15)
  • 블로그 메뉴

    • 홈
    • 태그
    • 글쓰기
    • 관리
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    브루트포스
    docker
    풀이 실패
    Til
    그리디 알고리즘
    99클럽
    python 석유시추
    파이썬 석유시추
    programmers 석유시추
    코딩테스트 준비
    백트래킹
    set
    백준 2470
    sequence item 0: expected str instance int found
    파이썬 과제 진행하기
    개발자 취업
    파이썬
    python 과제 진행하기
    백준
    sort
    프로그래머스 석유시추
    문자열을 원하는 길이로
    typeerror: sequence item 0: expected str instance int found
    LeetCode
    투포인터
    vscode
    Counter
    항해99
    두 포인터
    programmers 과제 진행하기
  • 최근 댓글

  • hELLO· Designed By정상우.v4.10.3
bbooo
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
상단으로

티스토리툴바