tanhLayer
说明
双曲正切 (tanh) 激活层对层输入应用 tanh 函数。
创建对象
属性
Name
— 层名称
''
(默认) | 字符向量 | 字符串标量
层名称,指定为字符向量或字符串标量。对于 Layer
数组输入,trainNetwork
、assembleNetwork
、layerGraph
和 dlnetwork
函数会自动为层指定名称 ''
。
数据类型: char
| string
NumInputs
— 输入的数目
1
(默认)
此 属性 为只读。
层输入的数目。此层只接受一个输入。
数据类型: double
InputNames
— 输入名称
{'in'}
(默认)
此 属性 为只读。
层的输入名称。此层只接受一个输入。
数据类型: cell
NumOutputs
— 输出的数目
1
(默认)
此 属性 为只读。
层输出的数目。此层只有一个输出。
数据类型: double
OutputNames
— 输出名称
{'out'}
(默认)
此 属性 为只读。
层的输出名称。此层只有一个输出。
数据类型: cell
示例
创建双曲正切层
创建一个名为 'tanh1'
的双曲正切 (tanh) 层。
layer = tanhLayer('Name','tanh1')
layer = TanhLayer with properties: Name: 'tanh1' Learnable Parameters No properties. State Parameters No properties. Show 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 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)