简体   繁体   English

RuntimeError('dot: 期望两个向量具有相同的 dtype,但发现 Double 和 Float

[英]RuntimeError('dot : expected both vectors to have same dtype, but found Double and Float

I am trying to perform this operation:我正在尝试执行此操作:

L_c += 1 - torch.abs(torch.dot(nuNormalized, Nu))

where:在哪里:

nuNormalized -> tensor([ 0.3790, -0.4208, 0.8242], dtype=torch.float64) numNormalized -> tensor([ 0.3790, -0.4208, 0.8242], dtype=torch.float64)

Nu -> tensor([-0.9961, -0.9961, -0.9961], device='cuda:0') Nu -> tensor([-0.9961, -0.9961, -0.9961], device='cuda:0')

I am getting this error:我收到此错误:

(<class 'RuntimeError'>, RuntimeError('dot: expected both vectors to have same dtype, but found Double and Float',), <traceback object at 0x7f4d276155c8>) (<class 'RuntimeError'>, RuntimeError('dot: 期望两个向量具有相同的 dtype,但发现 Double 和 Float',), <traceback object at 0x7f4d276155c8>)

Any suggestions please?请问有什么建议吗? Thanks!谢谢!

cast nuNormalized to float from double.将 nuNormalized 转换为从 double 浮动。

also you might consider moving both to the same device.您也可以考虑将两者移至同一设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RuntimeError: Found dtype Double 但预期 Float - PyTorch - RuntimeError: Found dtype Double but expected Float - PyTorch 运行时错误:发现 dtype Double 但预期为 Float - RuntimeError: Found dtype Double but expected Float Pytorch 得到 RuntimeError: Found dtype Double but expected Float - Pytorch getting RuntimeError: Found dtype Double but expected Float RuntimeError:找到 dtype Char 但预期 Float - RuntimeError: Found dtype Char but expected Float 为什么不转换 Tensor 的 dtype 修复“运行时错误:预期标量类型 Double 但发现 Float”? - Why doesn't converting the dtype of a Tensor fix "RuntimeError: expected scalar type Double but found Float"? RuntimeError:预期的标量类型 Double 但发现 Float - RuntimeError: expected scalar type Double but found Float RuntimeError:预期的标量类型为 Double 但发现为 Float - RuntimeError: expected scalar type Double but found Float RuntimeError: Found dtype Long but expected Float: 使用标准时 - RuntimeError: Found dtype Long but expected Float: When using criterion PyTorch | 得到“RuntimeError: Found dtype Long but expected Float” - PyTorch | getting "RuntimeError: Found dtype Long but expected Float" Pytorch CNN 训练中的“RuntimeError: expected scalar type Double but found Float” - “RuntimeError: expected scalar type Double but found Float” in Pytorch CNN training
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM