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

    你可能感兴趣的文章
    Mysql 事务知识点与优化建议
    查看>>
    Mysql 优化 or
    查看>>
    mysql 优化器 key_mysql – 选择*和查询优化器
    查看>>
    MySQL 优化:Explain 执行计划详解
    查看>>
    Mysql 会导致锁表的语法
    查看>>
    mysql 使用sql文件恢复数据库
    查看>>
    mysql 修改默认字符集为utf8
    查看>>
    Mysql 共享锁
    查看>>
    MySQL 内核深度优化
    查看>>
    mysql 内连接、自然连接、外连接的区别
    查看>>
    mysql 写入慢优化
    查看>>
    mysql 分组统计SQL语句
    查看>>
    Mysql 分页
    查看>>
    Mysql 分页语句 Limit原理
    查看>>
    MySql 创建函数 Error Code : 1418
    查看>>
    MySQL 创建新用户及授予权限的完整流程
    查看>>
    mysql 创建表,不能包含关键字values 以及 表id自增问题
    查看>>
    mysql 删除日志文件详解
    查看>>
    mysql 判断表字段是否存在,然后修改
    查看>>
    MySQL 到底能不能放到 Docker 里跑?
    查看>>