Are there any computational efficiency differences between nn.functional() Vs nn.sequential() in PyTorch

后端 未结 1 1143
小鲜肉
小鲜肉 2021-01-05 04:02

The following is a Feed-forward network using the nn.functional() module in PyTorch

import torch.nn as nn
import torch.nn.functional as F

class newNetwork(n         


        
相关标签:
1条回答
  • 2021-01-05 05:05

    There is no difference between the two. The latter is arguably more concise and easier to write and the reason for "objective" versions of pure (ie non-stateful) functions like ReLU and Sigmoid is to allow their use in constructs like nn.Sequential.

    0 讨论(0)
提交回复
热议问题