请我喝杯咖啡☕
*备忘录:
- 我的帖子解释了 add()。
- 我的帖子解释了 sub()。
- 我的帖子解释了 div()。
- 我的帖子解释了余数()。
- 我的帖子解释了 fmod()。
mul() 可以与零个或多个元素或标量的 0D 或多个 D 张量中的两个或零个或多个元素和一个标量的 0D 或多个 D 张量进行乘法。获取零个或多个元素的 0D 或多个 D 张量,如下所示:
*备忘录:
- mul() 可以与 torch 或张量一起使用。
- 第一个参数(输入)使用 torch(类型:int、float、complex 或 bool 的张量或标量)或使用张量(类型:int、float、complex 或 bool 的张量)(必需)。
- 带有 torch 的第二个参数或带有张量的第一个参数是其他(必需类型:张量或 int、float、complex 或 bool 标量)。
- torch 存在 out 参数(可选-默认:无-类型:张量):
*备注:
- 必须使用 out=。
- 我的帖子解释了论点。
- multiply() 是 mul() 的别名。
import torch tensor1 = torch.tensor([9, 7, 6]) tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]]) torch.mul(input=tensor1, other=tensor2) tensor1.mul(other=tensor2) # tensor([[36, -28, 18], [-18, 35, -30]]) torch.mul(input=9, other=tensor2) # tensor([[36, -36, 27], [-18, 45, -45]]) torch.mul(input=tensor1, other=4) # tensor([36, 28, 24]) torch.mul(input=9, other=4) # tensor(36) tensor1 = torch.tensor([9., 7., 6.]) tensor2 = torch.tensor([[4., -4., 3.], [-2., 5., -5.]]) torch.mul(input=tensor1, other=tensor2) # tensor([[36., -28., 18.], [-18., 35., -30.]]) torch.mul(input=9., other=tensor2) # tensor([[36., -36., 27.], [-18., 45., -45.]]) torch.mul(input=tensor1, other=4.) # tensor([36., 28., 24.]) torch.mul(input=9., other=4.) # tensor(36.) 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.mul(input=tensor1, other=tensor2) # tensor([[36.+0.j, -28.+0.j, 18.+0.j], # [-18.+0.j, 35.+0.j, -30.+0.j]]) torch.mul(input=9.+0.j, other=tensor2) # tensor([[36.+0.j, -36.+0.j, 27.+0.j], # [-18.+0.j, 45.+0.j, -45.+0.j]]) torch.mul(input=tensor1, other=4.+0.j) # tensor([36.+0.j, 28.+0.j, 24.+0.j]) torch.mul(input=9.+0.j, other=4.+0.j) # tensor(36.+0.j) tensor1 = torch.tensor([True, False, True]) tensor2 = torch.tensor([[False, True, False], [True, False, True]]) torch.mul(input=tensor1, other=tensor2) # tensor([[False, False, False], # [True, False, True]]) torch.mul(input=True, other=tensor2) # tensor([[False, True, False], [True, False, True]]) torch.mul(input=tensor1, other=False) # tensor([False, False, False]) torch.mul(input=True, other=False) # tensor(False)
以上是PyTorch 中的 mul的详细内容。更多信息请关注PHP中文网其他相关文章!

Python是解释型语言,但也包含编译过程。1)Python代码先编译成字节码。2)字节码由Python虚拟机解释执行。3)这种混合机制使Python既灵活又高效,但执行速度不如完全编译型语言。

useeAforloopWheniteratingOveraseQuenceOrforAspecificnumberoftimes; useAwhiLeLoopWhenconTinuingUntilAcIntiment.ForloopSareIdeAlforkNownsences,而WhileLeleLeleLeleLoopSituationSituationSituationsItuationSuationSituationswithUndEtermentersitations。

pythonloopscanleadtoerrorslikeinfiniteloops,modifyingListsDuringteritation,逐个偏置,零indexingissues,andnestedloopineflinefficiencies

forloopsareadvantageousforknowniterations and sequests,供应模拟性和可读性;而LileLoopSareIdealFordyNamicConcitionSandunknowniterations,提供ControloperRoverTermination.1)forloopsareperfectForeTectForeTerToratingOrtratingRiteratingOrtratingRitterlistlistslists,callings conspass,calplace,cal,ofstrings ofstrings,orstrings,orstrings,orstrings ofcces

pythonisehybridmodelofcompilationand interpretation:1)thepythoninterspretercompilesourcececodeintoplatform- interpententbybytecode.2)thepytythonvirtualmachine(pvm)thenexecuteCutestestestesteSteSteSteSteSteSthisByTecode,BelancingEaseofuseWithPerformance。

pythonisbothinterpretedAndCompiled.1)它的compiledTobyTecodeForportabilityAcrosplatforms.2)bytecodeisthenInterpreted,允许fordingfordforderynamictynamictymictymictymictyandrapiddefupment,尽管Ititmaybeslowerthananeflowerthanancompiledcompiledlanguages。

在您的知识之际,而foroopsareideal insinAdvance中,而WhileLoopSareBetterForsituations则youneedtoloopuntilaconditionismet

ForboopSareSusedwhenthentheneMberofiterationsiskNownInAdvance,而WhileLoopSareSareDestrationsDepportonAcondition.1)ForloopSareIdealForiteratingOverSequencesLikelistSorarrays.2)whileLeleLooleSuitableApeableableableableableableforscenarioscenarioswhereTheLeTheLeTheLeTeLoopContinusunuesuntilaspecificiccificcificCondond


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

Dreamweaver CS6
视觉化网页开发工具

WebStorm Mac版
好用的JavaScript开发工具

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

mPDF
mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),