# 마우스 효과 팅커벨
본문 바로가기 메뉴 바로가기

벼랑끝 바이오 매드 컴퓨터 사이언티스트

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

벼랑끝 바이오 매드 컴퓨터 사이언티스트

검색하기 폼
  • 분류 전체보기 (151)
    • Background (63)
      • Biology (8)
      • Math (42)
      • Statistics (8)
      • English (5)
    • Computer (66)
      • 백준 풀이 (7)
      • 이게 왜 안되지? (23)
      • 코딩 개꿀팁 (21)
      • 3B1B 따라잡기 with ManimLibrary (15)
    • Paper (4)
      • Bioinformatics (2)
      • CS (2)
    • Daily (16)
      • review (6)
      • etc (10)
  • 방명록

이왜안 (2)
[이왜안?] [RuntimeError]: Expected floating point type for target with class probabilities, got Long

torch의 nn module 내부의 loss function을 이용해서 loss를 구할 때에는 반드시 input의 type을 float으로 수정해준다. # 이하 코드는 input의 type이 int(long tensor)였기 때문에 이러한 에러가 난다. 따라서 input에 .float()를 붙여서 float type으로 바꿔주면 문제없이 실행이 된다.

Computer/이게 왜 안되지? 2023. 7. 10. 18:06
[이왜안?] TypeError: expected np.ndarray (got Tensor)

brief solution 1. torch.from_numpy needs np.ndarray arguments not an Tensor 인자로 numpy의 ndarray를 받아야 하는 from_numpy에 실수로 Tensor를 전달하고 있었다. label = Variable(torch.from_numpy(label).float()).to(device) 해당코드를 아래와 같이 수정하면 해결할 수 있다. label = Variable(torch.from_numpy(np.array(label)).float()).to(device) 본인 코드에서 인자로 ndarray를 받아야 하는 함수에 잘못된 Tensor 타입의 데이터를 전달하고 있는지를 확인해보자

Computer/이게 왜 안되지? 2022. 12. 31. 03:14
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
  • 벼랑끝 깃허브
  • 벼랑끝 강아지
TAG
  • 인공지능
  • 베이즈정리
  • 나노바디
  • 오일석기계학습
  • 최대우도추정
  • Matrix algebra
  • eigenvector
  • marginal likelihood
  • ai신약개발
  • manim
  • 기계학습
  • Manimlibrary
  • elementry matrix
  • kld
  • nanobody
  • 제한볼츠만머신
  • 3b1b
  • 이왜안
  • manim library
  • MLE
  • eigenvalue
  • MorganCircularfingerprint
  • variational autoencoder
  • MatrixAlgebra
  • kl divergence
  • 선형대수
  • 3B1B따라잡기
  • 백준
  • manimtutorial
  • 파이썬
more
«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바