SeparableConv2D 类tf_keras.layers.SeparableConv2D(
filters,
kernel_size,
strides=(1, 1),
padding="valid",
data_format=None,
dilation_rate=(1, 1),
depth_multiplier=1,
activation=None,
use_bias=True,
depthwise_initializer="glorot_uniform",
pointwise_initializer="glorot_uniform",
bias_initializer="zeros",
depthwise_regularizer=None,
pointwise_regularizer=None,
bias_regularizer=None,
activity_regularizer=None,
depthwise_constraint=None,
pointwise_constraint=None,
bias_constraint=None,
**kwargs
)
深度可分离二维卷积。
可分离卷积首先执行深度方向的空间卷积(分别作用于每个输入通道),然后执行逐点卷积来混合生成的输出通道。depth_multiplier 参数控制深度方向步骤中每个输入通道生成的输出通道数。
直观地说,可分离卷积可以理解为将卷积核分解为两个较小的核,或者作为 Inception 块的极端版本。
参数
dilation_rate值 != 1 不兼容。"valid" 或 "same" 之一(不区分大小写)。"valid" 表示不填充。"same" 会导致在输入的左右或上下均匀地填充零,以便输出具有与输入相同的高度/宽度维度。channels_last(默认值)或 channels_first 之一。输入中维度的顺序。channels_last 对应于形状为 (batch_size, height, width, channels) 的输入,而 channels_first 对应于形状为 (batch_size, channels, height, width) 的输入。如果未指定,则使用 Keras 配置文件 ~/.keras/keras.json(如果存在)中找到的 image_data_format 值,否则为 'channels_last'。默认为 'channels_last'。filters_in * depth_multiplier。keras.activations)。keras.initializers)。如果为 None,则将使用默认初始化器('glorot_uniform')。keras.initializers)。如果为 None,则将使用默认初始化器('glorot_uniform')。keras.initializers)。keras.regularizers)。keras.regularizers)。keras.regularizers)。keras.regularizers)。keras.constraints)。keras.constraints)。keras.constraints)。输入形状
如果 data_format='channels_first',则为形状为 (batch_size, channels, rows, cols) 的 4D 张量;如果 data_format='channels_last',则为形状为 (batch_size, rows, cols, channels) 的 4D 张量。
输出形状
如果 data_format='channels_first',则为形状为 (batch_size, filters, new_rows, new_cols) 的 4D 张量;如果 data_format='channels_last',则为形状为 (batch_size, new_rows, new_cols, filters) 的 4D 张量。由于填充,rows 和 cols 值可能已更改。
返回值
一个表示 activation(separableconv2d(inputs, kernel) + bias) 的秩为 4 的张量。
引发异常
padding 为 "causal"。