計算二維深度卷積。
用法
tf.compat.v1.nn.depthwise_conv2d_native(
input, filter, strides, padding, data_format='NHWC', dilations=[1, 1,
1, 1], name=None
)
參數
-
input
一個Tensor
。必須是以下類型之一:half
,bfloat16
,float32
,float64
。 -
filter
一個Tensor
。必須與input
具有相同的類型。 -
strides
ints
的列表。長度為 4 的一維。input
的每個維度的滑動窗口的步幅。 -
padding
控製在應用卷積之前如何填充圖像。可以是字符串"SAME"
或"VALID"
指示要使用的填充算法的類型,或者是指示每個維度開始和結束處的顯式填充的列表。當使用顯式填充且 data_format 為"NHWC"
時,應采用[[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]]
的形式。當使用顯式填充且 data_format 為"NCHW"
時,應采用[[0, 0], [0, 0], [pad_top, pad_bottom], [pad_left, pad_right]]
的形式。 -
data_format
一個可選的string
來自:"NHWC", "NCHW"
。默認為"NHWC"
。指定輸入和輸出數據的數據格式。使用默認格式"NHWC",數據存儲順序為:[batch, height, width, channels]。或者,格式可以是"NCHW",數據存儲順序為:[batch, channels, height, width]。 -
dilations
ints
的可選列表。默認為[1, 1, 1, 1]
。長度為 4 的一維張量。input
的每個維度的膨脹因子。如果設置為 k > 1,則在該維度上的每個過濾器元素之間將有 k-1 個跳過的單元格。維度順序由data_format
的值決定,詳見上文。批量和深度維度中的膨脹必須為 1。 -
name
操作的名稱(可選)。
返回
-
一個
Tensor
。具有與input
相同的類型。
給定一個形狀為 [batch, in_height, in_width, in_channels]
的輸入張量和一個形狀為 [filter_height, filter_width, in_channels, channel_multiplier]
的濾波器/內核張量,包含深度為 1 的 in_channels
卷積濾波器,depthwise_conv2d
對每個輸入通道應用不同的濾波器(從 1 個通道擴展到 channel_multiplier
個通道),然後將結果連接在一起。因此,輸出具有in_channels * channel_multiplier
通道。
for k in 0..in_channels-1
for q in 0..channel_multiplier-1
output[b, i, j, k * channel_multiplier + q] =
sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] *
filter[di, dj, k, q]
必須有 strides[0] = strides[3] = 1
。對於相同水平和頂點步幅的最常見情況,strides = [1, stride, stride, 1]
。
相關用法
- Python tf.compat.v1.nn.depthwise_conv2d用法及代碼示例
- Python tf.compat.v1.nn.dynamic_rnn用法及代碼示例
- Python tf.compat.v1.nn.dilation2d用法及代碼示例
- Python tf.compat.v1.nn.static_rnn用法及代碼示例
- Python tf.compat.v1.nn.sufficient_statistics用法及代碼示例
- Python tf.compat.v1.nn.embedding_lookup_sparse用法及代碼示例
- Python tf.compat.v1.nn.separable_conv2d用法及代碼示例
- Python tf.compat.v1.nn.weighted_cross_entropy_with_logits用法及代碼示例
- Python tf.compat.v1.nn.convolution用法及代碼示例
- Python tf.compat.v1.nn.conv2d用法及代碼示例
- Python tf.compat.v1.nn.safe_embedding_lookup_sparse用法及代碼示例
- Python tf.compat.v1.nn.nce_loss用法及代碼示例
- Python tf.compat.v1.nn.sampled_softmax_loss用法及代碼示例
- Python tf.compat.v1.nn.pool用法及代碼示例
- Python tf.compat.v1.nn.sigmoid_cross_entropy_with_logits用法及代碼示例
- Python tf.compat.v1.nn.ctc_loss用法及代碼示例
- Python tf.compat.v1.nn.rnn_cell.MultiRNNCell用法及代碼示例
- Python tf.compat.v1.nn.erosion2d用法及代碼示例
- Python tf.compat.v1.nn.raw_rnn用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.compat.v1.nn.depthwise_conv2d_native。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。