代码来源:https://github.com/eriklindernoren/ML-From-Scratch

卷积神经网络中卷积层Conv2D(带stride、padding)的具体实现:https://www.cnblogs.com/xiximayou/p/12706576.html

激活函数的实现(sigmoid、softmax、tanh、relu、leakyrelu、elu、selu、softplus):https://www.cnblogs.com/xiximayou/p/12713081.html

损失函数定义(均方误差、交叉熵损失):https://www.cnblogs.com/xiximayou/p/12713198.html

优化器的实现(SGD、Nesterov、Adagrad、Adadelta、RMSprop、Adam):https://www.cnblogs.com/xiximayou/p/12713594.html

卷积层反向传播过程:https://www.cnblogs.com/xiximayou/p/12713930.html

全连接层实现:https://www.cnblogs.com/xiximayou/p/12720017.html

批量归一化层实现:https://www.cnblogs.com/xiximayou/p/12720211.html

池化层实现:https://www.cnblogs.com/xiximayou/p/12720324.html

padding2D实现:https://www.cnblogs.com/xiximayou/p/12720454.html

Flatten层实现:https://www.cnblogs.com/xiximayou/p/12720518.html

上采样层UpSampling2D实现:https://www.cnblogs.com/xiximayou/p/12720558.html

Dropout层实现:https://www.cnblogs.com/xiximayou/p/12720589.html

之前就已经定义过了各种激活函数的前向和反向计算,这里只需要将其封装成类。

activation_functions = {
'relu': ReLU,
'sigmoid': Sigmoid,
'selu': SELU,
'elu': ELU,
'softmax': Softmax,
'leaky_relu': LeakyReLU,
'tanh': TanH,
'softplus': SoftPlus
} class Activation(Layer):
"""A layer that applies an activation operation to the input.
Parameters:
-----------
name: string
The name of the activation function that will be used.
""" def __init__(self, name):
self.activation_name = name
self.activation_func = activation_functions[name]()
self.trainable = True def layer_name(self):
return "Activation (%s)" % (self.activation_func.__class__.__name__) def forward_pass(self, X, training=True):
self.layer_input = X
return self.activation_func(X) def backward_pass(self, accum_grad):
return accum_grad * self.activation_func.gradient(self.layer_input) def output_shape(self):
return self.input_shape

【python实现卷积神经网络】激活层实现的更多相关文章

  1. 基于Python的卷积神经网络和特征提取

    基于Python的卷积神经网络和特征提取 用户1737318发表于人工智能头条订阅 224 在这篇文章中: Lasagne 和 nolearn 加载MNIST数据集 ConvNet体系结构与训练 预测 ...

  2. 关于LeNet-5卷积神经网络 S2层与C3层连接的参数计算的思考???

    https://blog.csdn.net/saw009/article/details/80590245 关于LeNet-5卷积神经网络 S2层与C3层连接的参数计算的思考??? 首先图1是LeNe ...

  3. 【python实现卷积神经网络】卷积层Conv2D反向传播过程

    代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...

  4. 【python实现卷积神经网络】全连接层实现

    代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...

  5. 【python实现卷积神经网络】批量归一化层实现

    代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...

  6. 【python实现卷积神经网络】池化层实现

    代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...

  7. 【python实现卷积神经网络】padding2D层实现

    代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...

  8. 【python实现卷积神经网络】Flatten层实现

    代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...

  9. 【python实现卷积神经网络】上采样层upSampling2D实现

    代码来源:https://github.com/eriklindernoren/ML-From-Scratch 卷积神经网络中卷积层Conv2D(带stride.padding)的具体实现:https ...

随机推荐

  1. JavaScript(7)--- 继承

    JavaScript(7)--- 继承 概念 首先继承是一种关系,类(class)与类之间的关系,JS中没有类,但是可以通过构造函数模拟类,然后通过原型来实现继承,继承也是为了数据共享. 之间有讲过j ...

  2. nmon使用问题汇总(不定期更新)

    nmon使用问题汇总 1.nmon常用命令: ./nmon -s1 -c300 -f -m /root/nmon-test-result/项目-50并发/ 2.设置nmon参数为-s1 -c720,发 ...

  3. SCF(SenparcCoreFramework) 系列教程(一):项目介绍及快速搭建

    2020年3月25日的“盛派周三分享”活动首次使用直播的方式与大家见面,共有 500 多人参与了活动,得到了众多开发者的好评,并强烈要求我分享 PPT,这点要求当然必须满足啦! 除此以外,还有许多开发 ...

  4. vue 2

    目录 复习 今日 指令 条件指令 循环指令 评论案例 解决插值表达式符号冲突 总结 组件 局部组件 全局组件 组件间的交互:父传子 组件间的交互:子传父 复习 """ 1 ...

  5. Docker镜像拉取慢的解决方法

    镜像加速器配置: 下文配置引用于阿里云说明文档:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors 1. 安装/升级Docker客户 ...

  6. Spring04——Spring MVC 全解析

    前文分别介绍了 Spring IOC 与 Spring AOP 的相关知识,本文将为各位大概带来 Spring MVC 的知识点.关注我的公众号「Java面典」,每天 10:24 和你一起了解更多 J ...

  7. mysql之日志

    我是李福春,我在准备面试,今天的题目是: mysql的redolog和binlog有什么区别? 答: 如下面的表格, redolog vs binlog 然后我们扩展一下,因为日志主要是记录的修改日志 ...

  8. Ribbon负载均衡实现

    1,在之前的博文中,我通过eureka,consul,zookeeper 实现了注册中心,在实现的服务发现过程中,都是通过RstTemplate 来实现RPC 远程调用 RestTemplate 封装 ...

  9. Python python 五种数据类型--数字

    一:Number 数字 不可变类型 整型(Int) - 通常被称为是整型或整数,是正或负整数,不带小数点. 长整型(long integers) - 无限大小的整数,整数最后是一个大写或小写的L.(P ...

  10. iOS 项目发布

    一.Apple开发者账号 1.1 开发者账号类型 个人级 公司级 企业级 公司和企业的可多人协作. 在苹果的开发者平台登录后,可在 People 界面邀请其他人员协作开发,邀请的人需要注册一个 app ...