LLFormer

发布时间 2023-04-09 22:31:33作者: helloWorldhelloWorld

LLFormer

1、rearrange:重塑形状

大佬链接:https://zhuanlan.zhihu.com/p/594012790

复制代码
import torch
import torch.nn.functional as F
from einops import rearrange

input = torch.randn(1,3,10,10)
print(input.shape)

x = rearrange(input, 'b c h w -> b (h w) c')
print(x.shape)
复制代码

 2、.var  返回给定维度 dim 中 input 张量的每一行的方差

torch.var(input, dim, unbiased=True, keepdim=False, *, out=None) → Tensor

大佬链接:PyTorch - torch.var 返回输入张量中所有元素的方差。 (runebook.dev)

 3、pytorch 中 torch.optim.Adam 方法的使用和参数的解释

大佬链接:https://blog.csdn.net/Ibelievesunshine/article/details/99624645