torch.nn.Parameter继承torch.Tensor,其作用将一个不可训练的类型为Tensor的参数转化为可训练的类型为parameter的参数,并将这个参数绑定到module里面,成为module中可训练的参数。
torch.nn.Parameter(Tensor data, bool requires_grad)
其中:data为传入Tensor类型参数,requires_grad默认值为True,表示可训练,False表示不可训练。
torch.nn.Parameter继承torch.Tensor,其作用将一个不可训练的类型为Tensor的参数转化为可训练的类型为parameter的参数,并将这个参数绑定到module里面,成为module中可训练的参数。
torch.nn.Parameter(Tensor data, bool requires_grad)
其中:data为传入Tensor类型参数,requires_grad默认值为True,表示可训练,False表示不可训练。