Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

tanhLayer

双曲正切 (tanh) 层

说明

双曲正切 (tanh) 激活层对层输入应用 tanh 函数。

创建对象

描述

layer = tanhLayer 创建一个双曲正切层。

示例

layer = tanhLayer('Name',Name) 还指定可选的 Name 属性。例如,tanhLayer('Name','tanh1') 创建一个名为 'tanh1' 的 tanh 层。

属性

全部展开

层名称,指定为字符向量或字符串标量。对于 Layer 数组输入,trainnettrainNetworkassembleNetworklayerGraphdlnetwork 函数会自动为层指定名称 ""

TanhLayer 对象将此属性存储为字符向量。

数据类型: char | string

此 属性 为只读。

层的输入数,返回为 1。此层只接受一个输入。

数据类型: double

此 属性 为只读。

输入名称,返回为 {'in'}。此层只接受一个输入。

数据类型: cell

此 属性 为只读。

层的输出数,返回为 1。此层只有一个输出。

数据类型: double

此 属性 为只读。

输出名称,返回为 {'out'}。此层只有一个输出。

数据类型: cell

示例

全部折叠

创建一个名为 'tanh1' 的双曲正切 (tanh) 层。

layer = tanhLayer('Name','tanh1')
layer = 
  TanhLayer with properties:

    Name: 'tanh1'

   Learnable Parameters
    No properties.

   State Parameters
    No properties.

Use properties method to see a list of all properties.

Layer 数组中包括一个 tanh 层。

layers = [
    imageInputLayer([28 28 1])
    convolution2dLayer(3,16)
    batchNormalizationLayer
    tanhLayer
    
    maxPooling2dLayer(2,'Stride',2)
    convolution2dLayer(3,32)
    batchNormalizationLayer
    tanhLayer
    
    fullyConnectedLayer(10)
    softmaxLayer
    classificationLayer]
layers = 
  11x1 Layer array with layers:

     1   ''   Image Input             28x28x1 images with 'zerocenter' normalization
     2   ''   2-D Convolution         16 3x3 convolutions with stride [1  1] and padding [0  0  0  0]
     3   ''   Batch Normalization     Batch normalization
     4   ''   Tanh                    Hyperbolic tangent
     5   ''   2-D Max Pooling         2x2 max pooling with stride [2  2] and padding [0  0  0  0]
     6   ''   2-D Convolution         32 3x3 convolutions with stride [1  1] and padding [0  0  0  0]
     7   ''   Batch Normalization     Batch normalization
     8   ''   Tanh                    Hyperbolic tangent
     9   ''   Fully Connected         10 fully connected layer
    10   ''   Softmax                 softmax
    11   ''   Classification Output   crossentropyex

算法

全部展开

扩展功能

C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。

GPU 代码生成
使用 GPU Coder™ 为 NVIDIA® GPU 生成 CUDA® 代码。

版本历史记录

在 R2019a 中推出