計算給定 4-D input 和 filter 張量的 2-D 卷積。
用法
tf.raw_ops.Conv2D(
input, filter, strides, padding, use_cudnn_on_gpu=True, explicit_paddings=[],
data_format='NHWC', dilations=[1, 1, 1, 1], name=None
)參數
-
input一個Tensor。必須是以下類型之一:half,bfloat16,float32,float64,int32。一個 4-D 張量。維度順序根據data_format的值進行解釋,詳見下文。 -
filter一個Tensor。必須與input具有相同的類型。形狀為[filter_height, filter_width, in_channels, out_channels]的 4-D 張量 -
stridesints的列表。長度為 4 的一維張量。input的每個維度的滑動窗口的步幅。維度順序由data_format的值決定,詳見下文。 -
paddingstring來自:"SAME", "VALID", "EXPLICIT"。要使用的填充算法的類型。 -
use_cudnn_on_gpu可選的bool。默認為True。 -
explicit_paddingsints的可選列表。默認為[]。如果padding是"EXPLICIT",則為顯式填充量列表。對於第 i 個維度,在維度之前和之後插入的填充量分別為explicit_paddings[2 * i]和explicit_paddings[2 * i + 1]。如果padding不是"EXPLICIT",explicit_paddings必須為空。 -
data_format一個可選的string來自:"NHWC", "NCHW"。默認為"NHWC"。指定輸入和輸出數據的數據格式。使用默認格式"NHWC",數據存儲順序為:[batch, height, width, channels]。或者,格式可以是"NCHW",數據存儲順序為:[batch, channels, height, width]。 -
dilationsints的可選列表。默認為[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, out_channels] 的濾波器/內核張量,此操作執行以下操作:
- 將過濾器展平為具有形狀的二維矩陣
[filter_height * filter_width * in_channels, output_channels]. - 從輸入張量中提取圖像塊以形成形狀的虛擬張量
[batch, out_height, out_width, filter_height * filter_width * in_channels]. - 對於每個補丁,right-multiplies 過濾器矩陣和圖像補丁向量。
詳細地說,使用默認的 NHWC 格式,
output[b, i, j, k] =
sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] *
filter[di, dj, q, k]
必須有 strides[0] = strides[3] = 1 。對於相同水平和頂點步幅的最常見情況,strides = [1, stride, stride, 1]。
相關用法
- Python tf.raw_ops.Conj用法及代碼示例
- Python tf.raw_ops.ConcatOffset用法及代碼示例
- Python tf.raw_ops.ComplexAbs用法及代碼示例
- Python tf.raw_ops.Cos用法及代碼示例
- Python tf.raw_ops.Cosh用法及代碼示例
- Python tf.raw_ops.Complex用法及代碼示例
- Python tf.raw_ops.Case用法及代碼示例
- Python tf.raw_ops.CheckNumerics用法及代碼示例
- Python tf.raw_ops.Cumsum用法及代碼示例
- Python tf.raw_ops.Cumprod用法及代碼示例
- Python tf.raw_ops.CumulativeLogsumexp用法及代碼示例
- Python tf.raw_ops.TPUReplicatedInput用法及代碼示例
- Python tf.raw_ops.Bitcast用法及代碼示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代碼示例
- Python tf.raw_ops.BatchMatMul用法及代碼示例
- Python tf.raw_ops.OneHot用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代碼示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代碼示例
- Python tf.raw_ops.GatherV2用法及代碼示例
- Python tf.raw_ops.Expm1用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.Conv2D。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
