Advertisement

深度学习中 torch.nn 常用的类 torch 中其他常用的类

阅读量:

Pytorch中神经网络模块化结构nn的了解——慢慢补充

orch.nn is designed specifically as a modular interface for neural networks. The nn module is built upon autograd, allowing us to define and run complex neural network architectures.

torch.nn.parameter

在深度学习的模型中,常见这样的语句:

复制代码
 #method 1

    
 import torch
    
 self.bias = torch.nn.parameter(torch.FloatTensor(out_features))
    
  
    
 #method 2
    
 import torch
    
 from torch.nn.parameter import Paramenter
    
 self.bias = Parameter(torch.FlaotTensor(out_features))
    
    
    
    
    AI写代码python
    
    运行

可以把此函数视为一种类型转换工具,在将无法进行参数训练的Tens

全部评论 (0)

还没有任何评论哟~