帮助中心帮助中心
应用 sigmoid 激活
自 R2019b 起
Y = sigmoid(X)
sigmoid 激活运算将 sigmoid 函数应用于输入数据。
此运算等效于
f(x)=11+e−x.
注意
此函数将 sigmoid 运算应用于 dlarray 数据。如果要在 layerGraph 对象或 Layer 数组中应用 sigmoid,请使用以下层:
dlarray
layerGraph
Layer
sigmoidLayer
示例
Y = sigmoid(X) 通过应用 sigmoid 传递函数来计算输入 X 的 sigmoid 激活。Y 中的所有值都介于 0 和 1 之间。
Y
X
0
1
全部折叠
使用 sigmoid 函数将输入数据中的所有值都设置为 0 和 1 之间的值。
sigmoid
将输入数据创建为由随机值组成的单个观测值,其高度和宽度分别为 7 个和 32 个通道。
height = 7; width = 7; channels = 32; observations = 1; X = randn(height,width,channels,observations); X = dlarray(X,'SSCB');
计算 sigmoid 激活。
Y = sigmoid(X);
Y 中的所有值现在都在 0 和 1 之间。
输入数据,指定为格式化的 dlarray、未格式化的 dlarray 或数值数组。
数据类型: single | double
single
double
sigmoid 激活,以 dlarray 形式返回。Y 中的所有值都介于 0 和 1 之间。输出 Y 与输入 X 具有相同的基础数据类型。
如果输入数据 X 是格式化的 dlarray,则 Y 与 X 具有相同的维度格式。如果输入数据不是格式化的 dlarray,则 Y 是未格式化的 dlarray,其维度顺序与输入数据相同。
使用说明和限制:
当输入参数 X 是基础数据类型为 gpuArray 的 dlarray 时,此函数在 GPU 上运行。
gpuArray
有关详细信息,请参阅Run MATLAB Functions on a GPU (Parallel Computing Toolbox)。
在 R2019b 中推出
dlarray | dlgradient | dlfeval | softmax | crossentropy | huber | mse
dlgradient
dlfeval
softmax
crossentropy
huber
mse
您点击的链接对应于以下 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:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office