RuntimeError: result type Float can't be cast to the desired output type Long
·
Error Note
- 전체 에러 문구 RuntimeError: result type Float can't be cast to the desired output type Long ​ => output 텐서와 target 텐서의 데이터 타입이 같지 않을 때 발생하는 에러입니다. ​ - 해결 방법 저의 경우에는 output 텐서는 float32 타입, target 텐서는 int64 타입이었습니다. 두 텐서의 데이터 타입을 동일하게 맞춰주었습니다. 따라서, target텐서를 float 타입으로 변경해주었습니다. labels => labels.float() self.loss(logits, labels.view([-1,1]).float(), alpha=0.75, reduction='mean')
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor,,,
·
Error Note
- 전체 에러 문구 TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first. ​ GPU에 할당된 텐서를 numpy 배열로 변환할 때 발생하는 에러입니다. 텐서 x를 np.array(x)로 변환할 때 발생합니다. ​ ​ - 해결 방법 문제가 되는 텐서를 cpu()함수를 이용해 CPU 텐서로 변환해주면 됩니다. x = x.cpu() ## CPU로 변환 x = np.array(x) ## numpy로 변환
[1] Video Visual Relation Detection
·
Paper Review/Video Scene Graph Generation
논문 링크:https://dl.acm.org/doi/pdf/10.1145/3123266.3123380?casa_token=Y_82TDmkH_EAAAAA:8GSiLS7kYaPj9ncAsizbVBRbxDI4CoJAcWeHbF46dJI8kfrtCPu9v3gFABKnM7x1bmKDt-Si56Td5Q Video Visual Relation Detection | Proceedings of the 25th ACM international conference on Multimedia ABSTRACT As a bridge to connect vision and language, visual relations between objects in the form of relation triplet $łangle subject..
알고리즘 기초 - 이진 트리(Binary Tree)
·
My Study/Algorithm
▶ 이진 트리(Binary Tree)란?이진 트리는 트리 자료구조 중에서 가장 간단한 형태의 트리입니다. 일반적인 이진 탐색 트리는 아래 그림과 같은 구조를 갖습니다. 모든 트리가 다 이진 트리는 아니며, 이진 탐색 트리는 아래와 같은 두 가지의 특징을 가집니다.- 부모 노드보다 왼쪽 자식 노드가 작습니다.- 부모 노드보다 오른쪽 자식 노드가 작습니다.수식으로 표현하자면 왼쪽 자식 노드 가 성립해야지만 이진 트리라고 할 수 있는 것입니다.​보통 이진 트리는 파이썬의 클래스를 이용해 표현합니다. 위 그림의 이진트리를 파이썬 코드를 이용해 나타내보겠습니다.class Node: ## 각 노드의 값과 왼쪽 노드와 오른쪽 노드의 정보 저장 def __init__(self, item): sel..