RuntimeError: einsum(): operands do not broadcast with remapped shapes [original->remapped]
Posted 沉迷单车的追风少年
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RuntimeError: einsum(): operands do not broadcast with remapped shapes [original->remapped]相关的知识,希望对你有一定的参考价值。
项目场景:
multihead-attention训练
out = torch.einsum(\'b h d e, b h d n -> b h e n\', context, q)
File "/root/anaconda3/lib/python3.7/site-packages/torch/functional.py", line 327, in einsum
return _VF.einsum(equation, operands) # type: ignore[attr-defined]
RuntimeError: einsum(): operands do not broadcast with remapped shapes [original->remapped]: [3, 4, 32, 32]->[3, 4, 32, 1, 32] [2, 4, 32, 65536]->[2, 4, 1, 65536, 32]
问题描述
完整报错:
Traceback (most recent call last):
File "multi_train.py", line 38, in <module>
trainer.train()
File "/root/sketchMultimodal/denoising-diffusion-pytorch-master/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py", line 661, in train
all_images_list = list(map(lambda n: self.ema_model.sample(condition=data_c, batch_size=n), batches))
File "/root/sketc
以上是关于RuntimeError: einsum(): operands do not broadcast with remapped shapes [original->remapped]的主要内容,如果未能解决你的问题,请参考以下文章
`numpy.einsum` 中的 `out` 参数无法按预期工作
Python 模块 Cupy 函数在使用 cupy.einsum() 时出错