728x90
반응형
Pytorch tensor 내 특정 값과 해당되는 index가 필요할 경우 아래 코드로 확인할 수 있다.
x = torch.Tensor([11, 22, 33, 22])
print((x==22).nonzero(as_tuple=True)[0])
https://stackoverflow.com/questions/47863001/how-pytorch-tensor-get-the-index-of-specific-value
https://normal-engineer.tistory.com/301
728x90
반응형
'사소한 Tip . 오류 해결법' 카테고리의 다른 글
IOError: cannot write mode CMYK as PNG (0) | 2023.03.28 |
---|---|
[Log 저장] 학습 과정에서 로그파일 작성 train.log / tee 명령어 (0) | 2023.03.17 |
한글 자모 분리될 때 (0) | 2023.03.14 |
[vscode] 파일 확장자로 나열 (0) | 2023.03.13 |
[Anaconda] environment copy / 환경 복제하기 (0) | 2023.03.08 |