博客
关于我
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/

    你可能感兴趣的文章
    OSPF故障排除技巧
    查看>>
    spring配置文件中<context:property-placeholder />的使用
    查看>>
    OSPF有哪些优势?解决了RIP的什么问题?
    查看>>
    OSPF理论
    查看>>
    OSPF的七种类型LSA
    查看>>
    OSPF的安全性考虑:全面解析与最佳实践
    查看>>
    OSPF知识点大全,网络工程师快速收藏!
    查看>>
    ospf综合实验2 2012/9/8
    查看>>
    OSPF规划两大模型:双塔奇兵、犬牙交错
    查看>>
    OSPF认证
    查看>>
    OSPF设计原则,命令以H3C为例
    查看>>
    OSPF路由协议配置
    查看>>
    OSPRay 开源项目教程
    查看>>
    VC++实现应用程序对插件的支持
    查看>>
    OSS 访问图片资源报“No ‘Access-Control-Allow-Origin‘”的错误
    查看>>
    ossfs常见配置错误
    查看>>
    Ossim4系统故障处理
    查看>>
    Spring赌上未来:响应式的 WebFlux 框架更优雅,性能更强!
    查看>>
    oss报UnknownHost,k8s设置hostAliases参数
    查看>>
    OSS直传与UXCore-Uploader实践
    查看>>