kingrangE
article thumbnail
Operator Module (오퍼레이터 모듈)이란?
Pytorch 2025. 3. 7. 14:31

개요AI agent 공부하다 아래와 같이 operator를 이용하는 부분을 만났습니다. 처음 보는 것 같아 찾아보게 되었고, 자주 쓸 것 같아서 기록해봅니다.## Graphclass State(TypedDict): topic : str # report topic sections : list[Section] completed_sections : Annotated[ list, operator.add # operator가 뭐지 ] final_report : str설명operator 모듈은 파이썬의 내장 연산자에 해당하는 효율적인 함수 집합을 내보냅니다.예를 들어, operator.add(x,y) 라고 한다면 x+y 와 동일한 결과라는 것입니다.종류종류가 매우 많기에..

article thumbnail
can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first. 오류 해결
Pytorch/Error 2024. 3. 4. 12:55

해당 오류는 GPU에 올라간 Tensor를 Numpy로 변환하면서 생기는 오류입니다. 따라서 GPU에 올라간 Tensor를 CPU로 내린 후, Numpy로 변경해주면 됩니다. 예시 x = torch.rand(5) x.numpy() #it occurs error x.cpu().numpy() # it doesnt occur error

article thumbnail
Python most likely due to a circular import 오류 1초 해결
Pytorch/Error 2024. 2. 16. 16:41

wandb를 테스트하려 하는데, most likely due to a circular import 라는 에러가 발생하였다. 이 오류는 import하려는 module의 이름과 파일의 이름이 동일하기 때문에 생기는 오류입니다. 절대 파일의 이름을 모듈과 동일하게 작성하지 마세요! 아래의 블로그를 참고하였습니다. https://acton21.tistory.com/13 파이썬 most likely due to a circular import 오류 해결방법 파이선을 초기에 학습할 때 모듈을 import하고 run을 돌려보니까 most likely due to a circular import 라는 에러가 뜨는 경우가 종종 있습니다. (+ 비슷하게 AttributeError: module 'pandas' has no..