parameters = filter(lambda p: p.requires_grad, model.parameters())
# for parameter in parameters:
# print(np.prod(parameter.size()) / 1_000_000)
parameters = sum([np.prod(p.size()) for p in parameters]) / 1_000_000
print('Trainable Parameters: %.3fM' % parameters)
11-05
567
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-30
2579
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-23
3035
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)