博客
关于我
ShuffleNetV2(torch.jit.ScriptModule)
阅读量:107 次
发布时间:2019-02-26

本文共 1731 字,大约阅读时间需要 5 分钟。

 

        #coding=utf-8        from collections import OrderedDict        import torch        import torch.nn as nn        import torch.nn.functional as F        from torch.nn import init        import timedef _make_divisible(v, divisor, min_value=None):            """This function is taken from the original tf repo.            It ensures that all layers have a channel number that is divisible by 8            It can be seen here: https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet/mobilenet.py            :param v:            :param divisor:            :param min_value: (optional)            :return:            """            if min_value is None:                min_value = divisor            new_v = max(min_value, int(v + divisor / 2.0) // divisor * divisor)            # Make sure that round down does not go down by more than 10%.            if new_v < 0.9 * v:                new_v += divisor            return new_v        class SELayer(nn.Module):            def __init__(self, channel, reduction=16):                # ??????                super(SELayer, self).__init__()                # ?????????                self.channel = channel                # ????????                self.reduction = reduction            def forward(self, x):                # ??????                # ??x                # ... (??????)                # ????????                return x            def __repr__(self):                # __repr__??                return f"SELayer({self.channel}d, reduction={self.reduction})"        

????????????????????

  • ????????????
  • ?????????
  • ???????????
  • ??????????
  • ???"first?second"????
  • ?????????????
  • ???????????
  • ??????????????
  • ???????????????????????????????

    转载地址:http://vrtk.baihongyu.com/

    你可能感兴趣的文章
    Node.js也分裂了-开源社区动态
    查看>>
    Node.js入门系列视频教程
    查看>>
    Node.js创建第一个应用
    查看>>
    Node.js初体验
    查看>>
    Node.js升级工具n
    查看>>
    Node.js卸载超详细步骤(附图文讲解)
    查看>>
    Node.js卸载超详细步骤(附图文讲解)
    查看>>
    Node.js基于Express框架搭建一个简单的注册登录Web功能
    查看>>
    node.js学习之npm 入门 —8.《怎样创建,发布,升级你的npm,node模块》
    查看>>
    Node.js安装与配置指南:轻松启航您的JavaScript服务器之旅
    查看>>
    Node.js安装及环境配置之Windows篇
    查看>>
    Node.js安装和入门 - 2行代码让你能够启动一个Server
    查看>>
    node.js安装方法
    查看>>
    Node.js官网无法正常访问时安装NodeJS的方法
    查看>>
    node.js模块、包
    查看>>
    node.js模拟qq漂流瓶
    查看>>
    node.js的express框架用法(一)
    查看>>
    Node.js的交互式解释器(REPL)
    查看>>
    Node.js的循环与异步问题
    查看>>
    Node.js高级编程:用Javascript构建可伸缩应用(1)1.1 介绍和安装-安装Node
    查看>>