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

    你可能感兴趣的文章
    【Bert101】变压器模型背后的复杂数学【02/4】
    查看>>
    Oracle面试题:Oracle中truncate和delete的区别
    查看>>
    ThreadLocal线程内部存储类
    查看>>
    thinkphp 常用SQL执行语句总结
    查看>>
    Oracle:ORA-00911: 无效字符
    查看>>
    Text-to-Image with Diffusion models的巅峰之作:深入解读 DALL·E 2
    查看>>
    Tensorflow.python.framework.errors_impl.ResourceExhaustedError:无法分配内存[操作:AddV2]
    查看>>
    TCP基本入门-简单认识一下什么是TCP
    查看>>
    tableviewcell 中使用autolayout自适应高度
    查看>>
    Symbolic Aggregate approXimation(SAX,符号聚合近似)介绍-ChatGPT4o作答
    查看>>
    Orcale表被锁
    查看>>
    svn访问报错500
    查看>>
    sum(a.YYSR) over (partition by a.hy_dm) 不需要像group by那样需要分组函数。方便。
    查看>>
    ORCHARD 是什么?
    查看>>
    Struts2中使用Session的两种方法
    查看>>
    Stream API:filter、map和flatMap 的用法
    查看>>
    STM32工作笔记0032---编写跑马灯实验---寄存器版本
    查看>>
    Static--用法介绍
    查看>>
    ssm旅游信息管理系统的设计与实现bus56(程序+开题)
    查看>>
    order by rand()
    查看>>