zoukankan      html  css  js  c++  java
  • 深度学习Keras框架笔记之TimeDistributedDense类

        深度学习Keras框架笔记之TimeDistributedDense类使用方法笔记

        例:         

    keras.layers.core.TimeDistributedDense(output_dim,init='glorot_uniform', activation='linear', weights=None  
    W_regularizer=None, b_regularizer=None, activity_regularizer=None, W_constraint=None, b_constraint=None,  
    input_dim=None, input_length=None)   

     这是一个基于时间维度的全连接层。主要就是用来构建RNN(递归神经网络)的,但是在构建RNN时需要设置return_sequences=True。

           inputshape: 3维 tensor(nb_samples, timesteps,input_dim)

           参数:

    •        output_dim: int >= 0,输出结果的维度
    •        init : 初始化权值的函数名称或Theano function。可以使用Keras内置的,也可以传递自己编写的Theano function。如果不给weights传递参数时,则该参数必须指明。
    •        activation : 激活函数名称或者Theano function。可以使用Keras内置的,也可以是传递自己编写的Theano function。如果不明确指定,那么将没有激活函数会被应用。
    •        weights :用于初始化权值的numpy arrays组成的list。这个List至少有1个元素,其shape为(input_dim, output_dim)。(如果指定init了,那么weights可以赋值None)
    •        W_regularizer:权值的规则化项,必须传入一个WeightRegularizer的实例(比如L1或L2规则化项)。
    •        b_regularizer:偏置值的规则化项,必须传入一个WeightRegularizer的实例(比如L1或L2规则化项)。
    •        activity_regularizer:网络输出的规则化项,必须传入一个ActivityRegularizer的实例。
    •        W_constraint:权值约束,必须传入一个constraints的实例。
    •        b_constraint:偏置约束,必须传入一个constraints的实例。
    •        input_dim:输入数据的维度。这个参数会在模型的第一层中用到。
    •        input_length:Length of input sequences, whenit is constant. This argument is required if you are going to connect Flattenthen Dense layers upstream (without it, the shape of the dense outputs cannotbe computed).
    • 例如:
    • # input shape: (nb_samples, timesteps,10)  
      model.add(LSTM(5, return_sequences=True, input_dim=10)) # output shape: (nb_samples, timesteps, 5)  
      model.add(TimeDistributedDense(15)) # output shape:(nb_samples, timesteps, 15)  
      

        

  • 相关阅读:
    使用MingGW-w64 Build Script 3.6.7搭建ffmpeg编译环境
    ffmpeg精简编译
    CListCtrl死锁的问题
    VC程序禁用提示框
    rtmp协议分析
    [置顶] zabbix发送告警
    [置顶] 个人微信号发送zabbix告警信息
    [置顶] 一个简单好用的zabbix告警信息发送工具
    [置顶] zabbix告警信息-lykchat信息发送系统
    模拟登陆web微信的流程和参数细节
  • 原文地址:https://www.cnblogs.com/68xi/p/8590759.html
Copyright © 2011-2022 走看看