(torch)如何构造一种forward 和backward 不同的layer

在BNN中,往往训练阶段较为复杂,而inference phase is simple.

So how can we build a layer with complex training progress and simple inference algorithm?

n1 = nn.Linear(4,5)
n1.train()
print(n1.__dict__)
n1.eval()
print(n1.__dict__)

  

The different phase has its corresponding __dict__

posted @ 2020-09-16 22:50  LoveGood_luna  阅读(226)  评论(0)    收藏  举报