当前位置: 首页 > wzjs >正文

网站外包公司有哪些青岛做网站公司排名

网站外包公司有哪些,青岛做网站公司排名,电商平台引流推广,wordpress商城主体文章目录Mish函数导函数函数和导函数图像优缺点PyTorch 中的 Mish 函数TensorFlow 中的 Mish 函数Mish 论文 https://arxiv.org/pdf/1908.08681 函数导函数 Mish函数 Mish(x)x⋅tanh⁡⁣(softplus(x))x⋅tanh⁡⁣(ln⁡⁣(1ex))\begin{aligned} \text{Mish}(x) & x \cdot \t…

文章目录

    • Mish
      • 函数+导函数
      • 函数和导函数图像
      • 优缺点
      • PyTorch 中的 Mish 函数
      • TensorFlow 中的 Mish 函数

Mish

  • 论文

    https://arxiv.org/pdf/1908.08681

函数+导函数

  • Mish函数
    Mish(x)=x⋅tanh⁡⁣(softplus(x))=x⋅tanh⁡⁣(ln⁡⁣(1+ex))\begin{aligned} \text{Mish}(x) &= x \cdot \tanh\!\bigl(\text{softplus}(x)\bigr) \\ &= x \cdot \tanh\!\Bigl(\ln\!\bigl(1+e^{x}\bigr)\Bigr) \end{aligned} Mish(x)=xtanh(softplus(x))=xtanh(ln(1+ex))

  • Mish函数导数

    已知:
    $$
    \frac{d}{dx}\tanh(x) =1- \rm tanh ^2(x) \[2mm]

    \frac{d}{dx}\operatorname{Softplus}(x)=\sigma(x)=\frac{1}{1+e^{-x}}
    $$
    参考:

    神经网络常见激活函数 2-tanh函数(双曲正切)

    则:
    $$
    \begin{aligned}
    \frac{\mathrm{d}}{\mathrm{d}x}\text{Mish}(x)
    &= x \cdot \tanh!\Bigl(\ln!\bigl(1+e^{x}\bigr)\Bigr)\

    &=\frac{\mathrm{d}}{\mathrm{d}x}x\cdot\tanh\bigl(\ln(1+e^{x})\bigr) + x \cdot \frac{\mathrm{d}}{\mathrm{d}x}\tanh\bigl(\ln(1+e^{x})\bigr) \[2mm]

    &=\tanh\bigl(\ln(1+e^{x})\bigr) + x \cdot\bigl(1-\tanh2(\ln(1+e{x})\bigr)\cdot\frac{1}{1+e^{-x}}\
    &=\tanh\bigl(\ln(1+e^{x})\bigr) + x \cdot\bigl(1-\tanh2(\ln(1+e{x})\bigr)\cdot\sigma(x)
    \end{aligned}
    $$


函数和导函数图像

  • 画图

    import numpy as np
    from matplotlib import pyplot as pltdef mish(x):"""Mish(x) = x * tanh(softplus(x))"""sp = np.log(1 + np.exp(x))          # softplus(x)return x * np.tanh(sp)def mish_derivative(x):"""Mish'(x) = tanh(softplus(x)) + x * (1 - tanh²(softplus(x))) * sigmoid(x)"""sp = np.log(1 + np.exp(x))          # softplus(x)t  = np.tanh(sp)                    # tanh(softplus(x))s  = 1 / (1 + np.exp(-x))           # sigmoid(x)return t + x  * (1 - t ** 2) * sx = np.linspace(-4, 4, 1000)
    y = mish(x)
    y1 = mish_derivative(x)plt.figure(figsize=(12, 8))
    ax = plt.gca()
    plt.plot(x, y, label='Mish')
    plt.plot(x, y1, label='Derivative', linestyle='--')
    plt.title('Mish Activation Function and its Derivative')ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')
    ax.xaxis.set_ticks_position('bottom')
    ax.spines['bottom'].set_position(('data', 0))
    ax.yaxis.set_ticks_position('left')
    ax.spines['left'].set_position(('data', 0))plt.legend(loc='upper left')
    plt.savefig('./mish.jpg',dpi=300)
    plt.show()
    

    mish


优缺点

  • Mish 的优点

    1. 平滑无断点:Mish 函数在整个实数域内连续可导,有助于稳定的梯度流,缓解梯度消失问题。
    2. 非单调性:负半轴有一段“下凹再回升”的曲线,有助于梯度流动,提升网络的表达能力。
    3. 无上界正值:正值部分无饱和区,避免梯度消失,适合深层网络,有有下界(≈ −0.31)。
    4. 实验性能:在 ImageNet、COCO 等多个基准上,Mish 常优于 ReLU、Swish 等激活函数。(并非绝对)
  • Mish 的缺点

    1. 计算开销大:相比 ReLU,需要额外计算 softplus、tanh 与乘法,推理延迟略高。
    2. 显存占用:反向传播需缓存中间结果,显存开销高于 ReLU。
    3. 并非万能:在某些轻量级或实时任务中,性能提升可能无法抵消额外计算成本,需要实验验证。

PyTorch 中的 Mish 函数

  • 代码

    import torch
    import torch.nn.functional as F# 固定随机种子
    torch.manual_seed(1024)      # CPU
    if torch.cuda.is_available():torch.cuda.manual_seed_all(42)   # GPU,如果有x = torch.randn(2,dtype=torch.float32)
    mish_x = mish(x)print(f"x:\n{x}")
    print(f"mish_x:\n{mish_x}")
    """输出示例"""
    x:
    tensor([-1.4837,  0.2671])
    mish_x:
    [-0.29912564  0.18258688]
    

TensorFlow 中的 Mish 函数

  • 环境

    python: 3.10.9
    tensorflow: 2.19.0

  • 代码

    import tensorflow as tfdef mish(x):return x * tf.math.tanh(tf.math.softplus(x))# 生成随机张量
    x = tf.constant([-1.4837, 0.2671], dtype=tf.float32)
    mish_x = mish(x)print(f"x:\n{x.numpy()}")
    print(f"mish_x:\n{mish_x.numpy()}")"""输出示例"""
    x:
    [-1.4837  0.2671]
    mish_x:
    [-0.29912373  0.18255362]
    


文章转载自:

http://ggB0pcDq.mhfbp.cn
http://f2mw5YVK.mhfbp.cn
http://qAJb00GJ.mhfbp.cn
http://OXX9LnhH.mhfbp.cn
http://z7KjKSyp.mhfbp.cn
http://iKAuLKnD.mhfbp.cn
http://O9j9A9S6.mhfbp.cn
http://nU9pxykp.mhfbp.cn
http://JF5nWOoj.mhfbp.cn
http://gDWgipnZ.mhfbp.cn
http://29jBd01Z.mhfbp.cn
http://LCl7cSpe.mhfbp.cn
http://IZl7V4lq.mhfbp.cn
http://MPs0i7Tk.mhfbp.cn
http://tGkOfuDQ.mhfbp.cn
http://t7PTCzIL.mhfbp.cn
http://F5ZvShwb.mhfbp.cn
http://cANoJh24.mhfbp.cn
http://17ahG1PM.mhfbp.cn
http://30yVZani.mhfbp.cn
http://hmvOWkqk.mhfbp.cn
http://bzlP9jXb.mhfbp.cn
http://dsDwut6S.mhfbp.cn
http://AWcjqFZ8.mhfbp.cn
http://Ok1qOsqr.mhfbp.cn
http://rtlr4NNY.mhfbp.cn
http://qLJVbcgR.mhfbp.cn
http://z3xXczeA.mhfbp.cn
http://H9FxzIjP.mhfbp.cn
http://FQj5myn1.mhfbp.cn
http://www.dtcms.com/wzjs/735303.html

相关文章:

  • 网站建设怎么购买空间成都微信小程序分类信息开发
  • 科技网站设计欣赏装饰工程投标书
  • 镇江网站建设联系思创设计公司企业定位
  • 阿里 网站建设河北沧州市网络公司
  • 嘉兴网站推广公司个人建站赚钱
  • python做网站有什么弊端在网上做广告怎么做
  • 个人免费开店的网站免费咨询律师的电话
  • 自己做网站需要固定ip吗如何选择网站开发语言
  • 云网站建设017年青大学网站建设招标
  • 广东网站se0优化公司深圳餐饮公司网站制作
  • perl 网站开发网站开发需求报告
  • 想做个ktv的网站怎么做洛江区建设局网站
  • 济宁 网站建设wordpress云视链
  • icp备案网站信息企业营销策划书模板
  • 弄个盈利网站做什么wordpress 医疗主题
  • 天津市精神文明建设网站wordpress 做 cms
  • 铁岭网络推广网站建设云南seo刷关键词排名优化
  • 网站开发公司联系电话制作网站编程
  • 网站建设教程在线内网网站怎么建设
  • 惠安县规划建设局网站斯皮尔网站建设
  • 青岛网站建设推广公司手机购物网站建设
  • 网站建设大图网站app的区别
  • 好点的开发网站的公司战地之王网站做任务
  • 网站怎么提高百度权重重庆网站建设最大
  • 最牛的设计网站建设网上国网推广方案
  • 如何使用凡科建设网站深圳网站设计公司哪家好
  • 网站开发nodejs开源php企业网站
  • 襄阳网站建设制作费用新手怎么开始做电商
  • 怎么找人做淘宝网站吗用别的公司域名做网站
  • 外贸电商网站制作手机app官方安装下载