Achetez-moi un café☕
*Mémos :
- Mon message explique add().
- Mon message explique mul().
- Mon message explique div().
- Mon message explique le reste().
- Mon message explique fmod().
sub() peut effectuer une soustraction avec deux des tenseurs 0D ou plus D de zéro ou plusieurs éléments ou scalaires ou le tenseur 0D ou plus D de zéro ou plusieurs éléments et un scalaire, obtenant le tenseur 0D ou plus D de zéro ou plusieurs éléments comme indiqué ci-dessous :
*Mémos :
- sub() peut être utilisé avec une torche ou un tenseur.
- Le 1er argument (entrée) avec torch (Type : tenseur ou scalaire de int, float ou complexe) ou en utilisant un tenseur (Type : tenseur de int, float ou complexe) (Obligatoire).
- Le 2ème argument avec torch ou le 1er argument avec un tenseur est autre (Required-Type : tenseur ou scalaire de int, float ou complexe).
- Le 3ème argument avec torch ou le 2ème argument avec un tenseur est alpha(Optional-Default:1-Type:tensor ou scalar of int, float ou complexe). *otherest multiplié par alpha(input ou un tenseur-(otherxalpha)).
- Il y a un argument avec torch(Optional-Default:None-Type:tensor) :
*Mémos :
- out= doit être utilisé.
- Mon message explique notre argument.
- subtract() est l'alias de sub().
import torch tensor1 = torch.tensor([9, 7, 6]) tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]]) torch.sub(input=tensor1, other=tensor2) tensor1.sub(other=tensor2) torch.sub(input=tensor1, other=tensor2, alpha=1) torch.sub(input=tensor1, other=tensor2, alpha=torch.tensor(1)) # tensor([[5, 11, 3], [11, 2, 11]]) torch.sub(input=tensor1, other=tensor2, alpha=0) torch.sub(input=tensor1, other=tensor2, alpha=torch.tensor(0)) # tensor([[9, 7, 6], [9, 7, 6]]) torch.sub(input=tensor1, other=tensor2, alpha=2) torch.sub(input=tensor1, other=tensor2, alpha=torch.tensor(2)) # tensor([[1, 15, 0], [13, -3, 16]]) torch.sub(input=tensor1, other=tensor2, alpha=-1) torch.sub(input=tensor1, other=tensor2, alpha=torch.tensor(-1)) # tensor([[13, 3, 9], [7, 12, 1]]) torch.sub(input=tensor1, other=tensor2, alpha=-2) torch.sub(input=tensor1, other=tensor2, alpha=torch.tensor(-2)) # tensor([[17, -1, 12], [5, 17, -4]]) torch.sub(input=9, other=tensor2) torch.sub(input=9, other=tensor2, alpha=1) torch.sub(input=9, other=tensor2, alpha=torch.tensor(1)) # tensor([[5, 13, 6], [11, 4, 14]]) torch.sub(input=tensor1, other=4) torch.sub(input=tensor1, other=4, alpha=1) torch.sub(input=tensor1, other=4, alpha=torch.tensor(1)) # tensor([5, 3, 2]) torch.sub(input=9, other=4) torch.sub(input=9, other=4, alpha=1) torch.sub(input=9, other=4, alpha=torch.tensor(1)) # tensor(5) tensor1 = torch.tensor([9., 7., 6.]) tensor2 = torch.tensor([[4., -4., 3.], [-2., 5., -5.]]) torch.sub(input=tensor1, other=tensor2) torch.sub(input=tensor1, other=tensor2, alpha=1.) torch.sub(input=tensor1, other=tensor2, alpha=torch.tensor(1.)) # tensor([[5., 11., 3.], [11., 2., 11.]]) torch.sub(input=9., other=tensor2) torch.sub(input=9., other=tensor2, alpha=1.) torch.sub(input=9., other=tensor2, alpha=torch.tensor(1.)) # tensor([[5., 13., 6.], [11., 4., 14.]]) torch.sub(input=tensor1, other=4) torch.sub(input=tensor1, other=4, alpha=1.) torch.sub(input=tensor1, other=4, alpha=torch.tensor(1.)) # tensor([5., 3., 2.]) torch.sub(input=9., other=4) torch.sub(input=9., other=4, alpha=1.) torch.sub(input=9., other=4, alpha=torch.tensor(1.)) # tensor(5.) tensor1 = torch.tensor([9.+0.j, 7.+0.j, 6.+0.j]) tensor2 = torch.tensor([[4.+0.j, -4.+0.j, 3.+0.j], [-2.+0.j, 5.+0.j, -5.+0.j]]) torch.sub(input=tensor1, other=tensor2) torch.sub(input=tensor1, other=tensor2, alpha=1.+0.j) torch.sub(input=tensor1, other=tensor2, alpha=torch.tensor(1.+0.j)) # tensor([[5.+0.j, 11.+0.j, 3.+0.j], # [11.+0.j, 2.+0.j, 11.+0.j]]) torch.sub(input=9.+0.j, other=tensor2) torch.sub(input=9.+0.j, other=tensor2, alpha=1.+0.j) torch.sub(input=9.+0.j, other=tensor2, alpha=torch.tensor(1.+0.j)) # tensor([[5.+0.j, 13.+0.j, 6.+0.j], # [11.+0.j, 4.+0.j, 14.+0.j]]) torch.sub(input=tensor1, other=4.+0.j) torch.sub(input=tensor1, other=4.+0.j, alpha=1.+0.j) torch.sub(input=tensor1, other=4.+0.j, alpha=torch.tensor(1.+0.j)) # tensor([5.+0.j, 3.+0.j, 2.+0.j]) torch.sub(input=9.+0.j, other=4.+0.j) torch.sub(input=9.+0.j, other=4.+0.j, alpha=1.+0.j) torch.sub(input=9.+0.j, other=4.+0.j, alpha=torch.tensor(1.+0.j)) # tensor(5.+0.j)
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

ForhandlingLargedatasetSInpython, UsenumpyArraysforbetterperformance.1) NumpyArraysAremeMory-EfficientAndFasterFornumericalOperations.2) EvitUnneceSsaryTypeConversions.3) Le effet de levier

Inpython, listSusedynamicMemoryallocation withover-allocation, whileLumpyArraySallocateFixedMemory.1) listsallocatemoreMoryThreededEdededInitialement, redimensipwenessary.2) NumpyArraySallocateExactMemoryForElements, offrantwectable usinessflexibilité.

Inpython, YouCanscthedatatatypeyfelemememedenernSspant.1) usenpynernrump.1) usenpynerp.dloatp.ploatm64, formateur préséconstrolatatype.

NumpyissentialFornumericalComputingInpythondutOtsSpeed, MemoryEfficiency et ComprehenSiveMathematicalFunctions.1) It'sfastBecauseitPerformSoperations INC.2) NumpyArraySareMoremory-EfficientThanpythonlists.3)

ContigusMymoryallocationiscrucialforAraySBauseitallowsforefficient andfastelementAccess.1) iTenablesConstanttimeAccess, o (1), duetoDirectAddressCalculation.2) itimproveScacheefficiendyAllowingMultipleElementFetchesperCacheline.3) itsimplieniesMemorymorymorymorymorymory

SlitingyPapyThonListIsDoneUsingTheSyntaxList [Démarrage: arrêt: étape] .He'showitworks: 1) startisheindexofthefirStelementoinclude.2) stopisTheIndexoftheFirstelementsoexclude.3) StepistheincrementBetweenselans.it'susefulfactingPortationSoListShsandCanusegeg

NumpyAllowsForvariousOperations ONARRAYS: 1) BasicarithmeticLikeaddition, Soustraction, Multiplication, anddivision; 2) AdvancedOperationSuchasmatrixMultiplication; 3) Element-Wiseoperations withoutExplicitloop

ArraySinpython, en particulier ThroughNumpyandPandas, aressentialfordataanalysis, offingspeeedAfficiency.1) numpyarrayablefficienthandlingoflargedatasetsandComplexOperationsLikEMoVingAverages.2)


Outils d'IA chauds

Undresser.AI Undress
Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover
Outil d'IA en ligne pour supprimer les vêtements des photos.

Undress AI Tool
Images de déshabillage gratuites

Clothoff.io
Dissolvant de vêtements AI

Video Face Swap
Échangez les visages dans n'importe quelle vidéo sans effort grâce à notre outil d'échange de visage AI entièrement gratuit !

Article chaud

Outils chauds

Télécharger la version Mac de l'éditeur Atom
L'éditeur open source le plus populaire

MinGW - GNU minimaliste pour Windows
Ce projet est en cours de migration vers osdn.net/projects/mingw, vous pouvez continuer à nous suivre là-bas. MinGW : un port Windows natif de GNU Compiler Collection (GCC), des bibliothèques d'importation et des fichiers d'en-tête librement distribuables pour la création d'applications Windows natives ; inclut des extensions du runtime MSVC pour prendre en charge la fonctionnalité C99. Tous les logiciels MinGW peuvent fonctionner sur les plates-formes Windows 64 bits.

Envoyer Studio 13.0.1
Puissant environnement de développement intégré PHP

SublimeText3 version chinoise
Version chinoise, très simple à utiliser

Navigateur d'examen sécurisé
Safe Exam Browser est un environnement de navigation sécurisé permettant de passer des examens en ligne en toute sécurité. Ce logiciel transforme n'importe quel ordinateur en poste de travail sécurisé. Il contrôle l'accès à n'importe quel utilitaire et empêche les étudiants d'utiliser des ressources non autorisées.
