一、Print(model)
import torch
from torch import nnnet = nn.Sequential(nn.Linear(4, 8), nn.ReLU(), nn.Linear(8, 1))
print(net)
outpu:二、torchsummary
Sequential(
(0): Linear(in_features=4, out_features=8, bias=True)
(1): ReLU()
(2): Linear(in_features=8, out_features=1, bias=True)
)
import torch
from torch import nnnet = nn.Sequential(nn.Linear(4, 8), nn.ReLU(), nn.Linear(8, 1))from torchsummary import summary
print(summary(net,input_size=(2,4)))
【机器学习|pytorch查看网络架构的几种方法】----------------------------------------------------------------
Layer (type) Output Shape Param #
==============================================================
Linear-1 [-1, 2, 8] 40
ReLU-2 [-1, 2, 8] 0
Linear-3 [-1, 2, 1] 9
==============================================================
Total params: 49
Trainable params: 49
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.00
Forward/backward pass size (MB): 0.00
Params size (MB): 0.00
Estimated Total Size (MB): 0.00
----------------------------------------------------------------
推荐阅读
- 单细胞系列|SCS【6】单细胞转录组之细胞类型自动注释 (SingleR)
- 单细胞系列|SCS【4】单细胞转录组数据可视化分析 (Seurat 4.0)
- SCI|FigDraw 19. SCI文章中绘图之坡度图(Slope Chart)
- SCI|FigDraw 20. SCI文章中绘图之马赛克图 (mosaic)
- RNA数据分析|Topic 15. 临床预测模型之决策曲线 (DCA)
- 笔记|初步认识机器学习(Machine Leaning)
- 支持向量机|从0开始,搞懂SVM支持向量机!
- 深度学习|深度学习开发环境搭建
- 数据标注|自然语音处理(NLP)系列(五)——详解智能问答系统