self.mul = nn.MultiheadAttention(128, 4, batch_first=True)
有大佬能解释一下,这里为何用True就报错,用False就没问题,是什么原因呢?调试了一下,不管是False还是True,执行这句后,mul的num_heads都是4,kdim都是128,embed_dim都是128,vdim都是128.
MultiheadAttention 类的代码中写的说明:
batch_first: If ``True``, then the input and output tensors are provided
as (batch, seq, feature). Default: ``False`` (seq, batch, feature).
128和4是分别传给哪个参数了啊?谢谢
【 在 feng321 的大作中提到: 】
: [code=py]
: import torch
: from torch import nn
: ...................
--
FROM 120.242.238.*