zoukankan      html  css  js  c++  java
  • Tensorflow Keras tutotrials01

    tf.keras.Sequential

    groups a linear stack Models into Sequential

    Here are  quick starts for the beginners and experts respectively: MINIST Recongnization

    So, the key point of the programming is about how to build the Model. Here, we build tf.keras model using subclass tf.keras.Sequential.

    Then,we talk about how to use Sequential model:

    Sequential model is appropriate for a plain stack of layers where each layer has exactly one input tensor and one output tensor.

    Schematically, the following Sequential model:

    # Define Sequential model with 3 layers
    model = keras.Sequential(
        [
            layers.Dense(2, activation="relu", name="layer1"),
            layers.Dense(3, activation="relu", name="layer2"),
            layers.Dense(4, name="layer3"),
        ]
    )
    # Call model on a test input
    x = tf.ones((3, 3))
    y = model(x)

    Dense implements the operation: output = activation(dot(input, kernel) + bias) where activation is the element-wise activation function passed as the activation argument, kernel is a weights matrix created by the layer, and bias is a bias vector created by the layer (only applicable if use_bias is True).

    units Positive integer, dimensionality of the output space.
    activation Activation function to use. If you don't specify anything, no activation is applied (ie. "linear" activation: a(x) = x).
    use_bias Boolean, whether the layer uses a bias vector.
    kernel_initializer Initializer for the kernel weights matrix.
    bias_initializer Initializer for the bias vector.
    kernel_regularizer Regularizer function applied to the kernel weights matrix.
    bias_regularizer Regularizer function applied to the bias vector.
    activity_regularizer Regularizer function applied to the output of the layer (its "activation").
    kernel_constraint Constraint function applied to the kernel weights matrix.
    bias_constraint Constraint function applied to the bias vector.

    Input shape:

    N-D tensor with shape: (batch_size, ..., input_dim). The most common situation would be a 2D input with shape (batch_size, input_dim).

    Output shape:

    N-D tensor with shape: (batch_size, ..., units). For instance, for a 2D input with shape (batch_size, input_dim), the output would have shape (batch_size, units).

    *relationship between tensorflow and keras

  • 相关阅读:
    python 求取代码运行时间
    Python中的继承、抽象基类和接口
    Python安装和环境配置,让你轻松入门学习Python!
    python入门python的基本语法
    没有对象?程序员的浪漫,对象攻略(1)
    python实现邮件循环自动发件
    docker查看全部容器命令
    python speech模块的使用方法
    开宗立派宣言
    多个 (li) 标签如何获取获取选中的里面的某个特定值
  • 原文地址:https://www.cnblogs.com/yuelien/p/14443154.html
Copyright © 2011-2022 走看看