찾다

PyTorch에서 isclose

Nov 04, 2024 am 10:31 AM

isclose in PyTorch

커피 한잔 사주세요😄

*메모:

  • 내 게시물에서는 equal(), eq() 및 ne()에 대해 설명합니다.
  • 내 게시물에서는 gt() 및 lt()에 대해 설명합니다.
  • 내 게시물에는 ge() 및 le()에 대한 설명이 나와 있습니다.

isclose()는 첫 번째 0D 이상의 D 텐서 중 0개 이상의 요소가 요소별로 두 번째 0D 이상의 D 텐서의 0개 이상의 요소와 같거나 거의 같은지 확인하여 0D 이상의 요소를 가져옵니다. 아래와 같이 0개 이상의 요소로 구성된 D 텐서:

*메모:

  • isclose()는 토치나 텐서와 함께 사용할 수 있습니다.
  • 토치 또는 텐서(필수 유형: int, float, complex 또는 bool의 텐서)를 사용하는 첫 번째 인수(입력).
  • torch의 두 번째 인수 또는 텐서의 첫 번째 인수는 other(필수 유형: int, float, complex 또는 bool의 텐서)입니다.
  • torch의 세 번째 인수 또는 tensor의 두 번째 인수는 rtol(Optional-Default:1e-05-Type:float)입니다.
  • torch의 네 번째 인수 또는 텐서의 세 번째 인수는 atol(Optional-Default:1e-08-Type:float)입니다.
  • torch의 5번째 인수 또는 텐서의 4번째 인수는 equal_nan(Optional-Default:False-Type:bool)입니다. *메모:
    • True이면 nan과 nan은 True를 반환합니다.
    • 기본적으로 nan과 nan은 False를 반환합니다.
  • 공식은 |입력 - 기타|
import torch

tensor1 = torch.tensor([1.00001001, 1.00000996, 1.00000995, torch.nan])
tensor2 = torch.tensor([1., 1., 1., torch.nan])

torch.isclose(input=tensor1, other=tensor2)
torch.isclose(input=tensor1, other=tensor2,
              rtol=1e-05, atol=1e-08, equal_nan=False)
            # 0.00001   # 0.00000001
tensor1.isclose(other=tensor2)
torch.isclose(input=tensor2, other=tensor1)
# tensor([False, False, True, False])

torch.isclose(input=tensor1, other=tensor2, equal_nan=True)
# tensor([False, False, True, True])

tensor1 = torch.tensor([[1.00001001, 1.00000996],
                        [1.00000995, torch.nan]])
tensor2 = torch.tensor([[1., 1.],
                        [1., torch.nan]])
torch.isclose(input=tensor1, other=tensor2)
torch.isclose(input=tensor2, other=tensor1)
# tensor([[False, False],
#         [True, False]])

tensor1 = torch.tensor([[[1.00001001],
                         [1.00000996]],
                        [[1.00000995],
                         [torch.nan]]])
tensor2 = torch.tensor([[[1.], [1.]],
                        [[1.], [torch.nan]]])
torch.isclose(input=tensor1, other=tensor2)
torch.isclose(input=tensor2, other=tensor1)
# tensor([[[False], [False]],
#         [[True], [False]]])

tensor1 = torch.tensor([[1.00001001, 1.00000996],
                        [1.00000995, torch.nan]])
tensor2 = torch.tensor([1., 1.])

torch.isclose(input=tensor1, other=tensor2)
torch.isclose(input=tensor2, other=tensor1)
# tensor([[False, False],
#         [True, False]])

tensor1 = torch.tensor([[1.00001001, 1.00000996],
                        [1.00000995, torch.nan]])
tensor2 = torch.tensor(1.)

torch.isclose(input=tensor1, other=tensor2)
torch.isclose(input=tensor2, other=tensor1)
# tensor([[False, False],
#         [True, False]])

tensor1 = torch.tensor([0, 1, 2])
tensor2 = torch.tensor(1)

torch.isclose(input=tensor1, other=tensor2)
# tensor([False, True, False])

tensor1 = torch.tensor([0.+0.j, 1.+0.j, 2.+0.j])
tensor2 = torch.tensor(1.+0.j)

torch.isclose(input=tensor1, other=tensor2)
# tensor([False, True, False])

tensor1 = torch.tensor([False, True, False])
tensor2 = torch.tensor(True)

torch.isclose(input=tensor1, other=tensor2)
# tensor([False, True, False])

위 내용은 PyTorch에서 isclose의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
파이썬 어레이에서 수행 할 수있는 일반적인 작업은 무엇입니까?파이썬 어레이에서 수행 할 수있는 일반적인 작업은 무엇입니까?Apr 26, 2025 am 12:22 AM

PythonArraysSupportVariousOperations : 1) SlicingExtractsSubsets, 2) 추가/확장 어드먼트, 3) 삽입 값 삽입 ATSpecificPositions, 4) retingdeletesElements, 5) 분류/ReversingChangesOrder 및 6) ListsompectionScreateNewListSbasedOnsistin

어떤 유형의 응용 프로그램에서 Numpy Array가 일반적으로 사용됩니까?어떤 유형의 응용 프로그램에서 Numpy Array가 일반적으로 사용됩니까?Apr 26, 2025 am 12:13 AM

NumpyArraysareSentialplosplicationSefficationSefficientNumericalcomputationsanddatamanipulation. Theyarcrucialindatascience, MachineLearning, Physics, Engineering 및 Financeduetotheiribility에 대한 handlarge-scaledataefficivally. forexample, Infinancialanyaly

파이썬의 목록 위의 배열을 언제 사용 하시겠습니까?파이썬의 목록 위의 배열을 언제 사용 하시겠습니까?Apr 26, 2025 am 12:12 AM

UseanArray.ArrayOveralistInpyThonWhendealingwithhomogeneousData, Performance-CriticalCode, OrinterFacingwithCcode.1) HomogeneousData : ArraysSaveMemorywithtypepletement.2) Performance-CriticalCode : arraysofferbetterporcomanceFornumericalOperations.3) Interf

모든 목록 작업은 배열에 의해 지원됩니까? 왜 또는 왜 그렇지 않습니까?모든 목록 작업은 배열에 의해 지원됩니까? 왜 또는 왜 그렇지 않습니까?Apr 26, 2025 am 12:05 AM

아니요, NOTALLLISTOPERATIONARESUPPORTEDBYARRARES, andVICEVERSA.1) ArraySDONOTSUPPORTDYNAMICOPERATIONSLIKEPENDORINSERTWITHUTRESIGING, WHITHIMPACTSPERFORMANCE.2) ListSDONOTEECONSTANTTIMECOMPLEXITEFORDITITICCESSLIKEARRAYSDO.

파이썬 목록에서 요소에 어떻게 액세스합니까?파이썬 목록에서 요소에 어떻게 액세스합니까?Apr 26, 2025 am 12:03 AM

ToaccesselementsInapyThonlist, 사용 인덱싱, 부정적인 인덱싱, 슬라이스, 오리 화.

어레이는 파이썬으로 과학 컴퓨팅에 어떻게 사용됩니까?어레이는 파이썬으로 과학 컴퓨팅에 어떻게 사용됩니까?Apr 25, 2025 am 12:28 AM

Arraysinpython, 특히 비밀 복구를위한 ArecrucialInscientificcomputing.1) theaRearedFornumericalOperations, DataAnalysis 및 MachinELearning.2) Numpy'SimplementationIncensuressuressurations thanpythonlists.3) arraysenablequick

같은 시스템에서 다른 파이썬 버전을 어떻게 처리합니까?같은 시스템에서 다른 파이썬 버전을 어떻게 처리합니까?Apr 25, 2025 am 12:24 AM

Pyenv, Venv 및 Anaconda를 사용하여 다양한 Python 버전을 관리 할 수 ​​있습니다. 1) PYENV를 사용하여 여러 Python 버전을 관리합니다. Pyenv를 설치하고 글로벌 및 로컬 버전을 설정하십시오. 2) VENV를 사용하여 프로젝트 종속성을 분리하기 위해 가상 환경을 만듭니다. 3) Anaconda를 사용하여 데이터 과학 프로젝트에서 Python 버전을 관리하십시오. 4) 시스템 수준의 작업을 위해 시스템 파이썬을 유지하십시오. 이러한 도구와 전략을 통해 다양한 버전의 Python을 효과적으로 관리하여 프로젝트의 원활한 실행을 보장 할 수 있습니다.

표준 파이썬 어레이를 통해 Numpy Array를 사용하면 몇 가지 장점은 무엇입니까?표준 파이썬 어레이를 통해 Numpy Array를 사용하면 몇 가지 장점은 무엇입니까?Apr 25, 2025 am 12:21 AM

Numpyarrayshaveseveraladvantagesstandardpythonarrays : 1) thearemuchfasterduetoc 기반 간증, 2) thearemorememory-refficient, 특히 withlargedatasets 및 3) wepferoptizedformationsformationstaticaloperations, 만들기, 만들기

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

ZendStudio 13.5.1 맥

ZendStudio 13.5.1 맥

강력한 PHP 통합 개발 환경

맨티스BT

맨티스BT

Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

PhpStorm 맥 버전

PhpStorm 맥 버전

최신(2018.2.1) 전문 PHP 통합 개발 도구