国产成人AV无码一二三区,少女1到100集,国产精品久久久久精品综合紧,巜公妇之诱感肉欲HD在线播放

文章 > 头条 > Pytorch网络结构可视化

Pytorch网络结构可视化

头像

Python

2019-06-26 12:45:037151浏览 · 0收藏 · 0评论

Pytorch网络结构可视化:PyTorch是使用GPU和CPU优化的深度学习张量库。

安装

可以通过以下的命令进行安装

conda install pytorch-nightly -c pytorch
conda install graphviz
conda install torchvision
conda install tensorwatch

基于以下的版本:

torchvision.__version__   '0.2.1'
torch.__version__         '1.2.0.dev20190610'
sys.version               '3.6.8 |Anaconda custom (64-bit)| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0]'

载入库

import sys
import torch
import tensorwatch as tw
import torchvision.models

网络结构可视化

alexnet_model = torchvision.models.alexnet()
tw.draw_model(alexnet_model, [1, 3, 224, 224])

载入alexnet,draw_model函数需要传入三个参数,第一个为model,第二个参数为input_shape,第三个参数为orientation,可以选择'LR'或者'TB',分别代表左右布局与上下布局。

在notebook中,执行完上面的代码会显示如下的图,将网络的结构及各个层的name和shape进行了可视化。

360截图17500924153262.png

统计网络参数

可以通过model_stats方法统计各层的参数情况。

360截图184702017611198.png

tw.model_stats(alexnet_model, [1, 3, 224, 224])
[MAdd]: Dropout is not supported!
[Flops]: Dropout is not supported!
[Memory]: Dropout is not supported!
[MAdd]: Dropout is not supported!
[Flops]: Dropout is not supported!
[Memory]: Dropout is not supported!
[MAdd]: Dropout is not supported!
[Flops]: Dropout is not supported!
[Memory]: Dropout is not supported!
[MAdd]: Dropout is not supported!
[Flops]: Dropout is not supported!
[Memory]: Dropout is not supported!
[MAdd]: Dropout is not supported!
[Flops]: Dropout is not supported!
[Memory]: Dropout is not supported!
[MAdd]: Dropout is not supported!
[Flops]: Dropout is not supported!
[Memory]: Dropout is not supported!
alexnet_model.features
Sequential(
  (0): Conv2d(3, 64, kernel_size=(11, 11), stride=(4, 4), padding=(2, 2))
  (1): ReLU(inplace=True)
  (2): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)
  (3): Conv2d(64, 192, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2))
  (4): ReLU(inplace=True)
  (5): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)
  (6): Conv2d(192, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
  (7): ReLU(inplace=True)
  (8): Conv2d(384, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
  (9): ReLU(inplace=True)
  (10): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
  (11): ReLU(inplace=True)
  (12): MaxPool2d(kernel_size=3, stride=2, padding=0, dilation=1, ceil_mode=False)
)
alexnet_model.classifier
Sequential(
  (0): Dropout(p=0.5)
  (1): Linear(in_features=9216, out_features=4096, bias=True)
  (2): ReLU(inplace=True)
  (3): Dropout(p=0.5)
  (4): Linear(in_features=4096, out_features=4096, bias=True)
  (5): ReLU(inplace=True)
  (6): Linear(in_features=4096, out_features=1000, bias=True)
)
关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

回娘家白天像父女晚上像夫妻| 《囚禁空姐》电影免费观看| 成品人和精品人的区别9点| 开会桌下把荫蒂添的好多水| 女人高潮抖动多久能恢复正常| 性做爰A片春欲| 我就去色| 九妹网| 荷兰日B赛现场视频| 姐妹花齐飞| 蜜桃免费观看电视剧高清完整版| 儿媳妇免费播放全部电视剧| 舒淇最惊艳三部电影| 亲吻刺激战场视频大全免费观看| 白丝| 《湿点》末增减板相似| 40岁女人如饥似渴最佳解决方法| 公交车上被蹭水后多久自然恢复| 美国式禁忌| お母さんは母のがいない怎么读 | 年轻的老师| 《性房纵欲》在线观看| 兽父1到16集一口气看完| 宝宝水帘洞都拉丝了怎么办| 《一滴都不许漏》何泽城林荫 | 国精产品一品二品国精HTC| 续父开续女包小芳的小说破 | 朝铜光| 东北娘们国语版免费播放| 日本《暴力强伦轩》| 性做爰A片春欲| 公交车NP粗暴H强J玩弄| 狗和女人戴避孕套会传染吗| 星空麻花MV高清| 免费观看已满十八岁电视剧日剧| 白丝脚上的浓浓的精华液能用吗| 亲你私下的男人最有效的一句 | 脏脏漫| 免费又黄又硬又爽又免费| 《共享弟夫》动漫在线观看免费| 我把刘姨俩腿扛在肩上是哪一集的