LaVIN
LaVIN copied to clipboard
关于repAdapter_Router 代码的疑问
with autocast():
if weights is None:
#
weights = torch.softmax(self.expert_weights(x[:, 0]) / self.t, -1).half()
请问self.expert_weights(x[:, 0]) 中为何取 x[: , 0] 作为输入参数呢? x 的shape 可以表示为 L, B, C 为何在B 维度上仅取0位置呢?
x的shape是B,L, C, 所以取的是L的0位置,即cls token。 希望对你有帮助~
感谢