填充¶
填充 - 23¶
版本¶
名稱:填充 (GitHub)
網域:
main
自版本:
23
函數:
False
支援等級:
SupportType.COMMON
形狀推斷:
True
此版本的運算子自版本 23 起可用。
摘要¶
給定一個包含要填充的資料的張量 (data
)、一個包含每個軸的起始和結束填充值的數量的張量 (pads
)、(可選的)一個 mode
,以及(可選的)constant_value
,則會產生一個填充後的張量 (output
)。
支援的三種 modes
為(類似於 numpy.pad
支援的對應模式)
constant
(預設) - 使用由constant_value
指定的給定常數值進行填充(預設值為 0、空字串或 False)reflect
- 使用向量在每個軸的向量的第一個和最後一個值上鏡像的反射來填充edge
- 使用陣列的邊緣值進行填充wrap
- 環繞填充,如同資料張量形成一個環面
範例 1 (constant
模式)
在第二個維度的開頭插入 0 填充。
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'constant'
constant_value = 0.0
output = [
[0.0, 0.0, 1.0, 1.2],
[0.0, 0.0, 2.3, 3.4],
[0.0, 0.0, 4.5, 5.7],
]
範例 2 (reflect
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'reflect'
output = [
[1.0, 1.2, 1.0, 1.2],
[2.3, 3.4, 2.3, 3.4],
[4.5, 5.7, 4.5, 5.7],
]
範例 3 (edge
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'edge'
output = [
[1.0, 1.0, 1.0, 1.2],
[2.3, 2.3, 2.3, 3.4],
[4.5, 4.5, 4.5, 5.7],
]
範例 4 (wrap
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [2, 1, 1, 1]
mode = 'wrap'
output = [
[3.4, 2.3, 3.4, 2.3],
[5.7, 4.5, 5.7, 4.5],
[1.2, 1.0, 1.2, 1.0],
[3.4, 2.3, 3.4, 2.3],
[5.7, 4.5, 5.7, 4.5],
[1.2, 1.0, 1.2, 1.0],
]
屬性¶
mode - STRING(預設為
'constant'
)支援的模式:
constant
(預設)、reflect
、edge
、wrap
輸入¶
介於 2 和 4 個輸入之間。
data (異質) - T
輸入張量。
pads (異質) - tensor(int64)
整數張量,表示在每個軸的開頭和結尾處新增或移除(如果為負數)的填充元素數。對於 2D 輸入張量,它是像素的數量。
pads
應為形狀 [2 * num_axes] 的 1D 張量,其中num_axes
是指axes
輸入中的元素數,如果未明確提供axes
,則是指輸入的階數。pads
格式應為:[x1_begin, x2_begin, …, x1_end, x2_end,…],其中 xi_begin 是在軸axes[i]
開頭新增的填充值數量,而 xi_end 是在軸axes[i]
結尾新增的填充值數量。constant_value (可選,異質) - T
(可選)如果選擇的模式為
constant
,則要使用的純量值(預設為 0、空字串或 False)。axes (可選,異質) - Tind
pads
應用於的軸的 1 維張量。負值表示從後面計算維度。接受範圍為 [-r, r-1],其中 r = rank(data)。如果重複軸,則行為未定義。如果未提供,則假設所有軸 ([0, 1, ..., input_rank-1]
)。
輸出¶
output (異質) - T
填充後的張量。
類型約束¶
T in (
tensor(bfloat16)
,tensor(bool)
,tensor(complex128)
,tensor(complex64)
,tensor(double)
,tensor(float)
,tensor(float16)
,tensor(float4e2m1)
,tensor(float8e4m3fn)
,tensor(float8e4m3fnuz)
,tensor(float8e5m2)
,tensor(float8e5m2fnuz)
,tensor(int16)
,tensor(int32)
,tensor(int4)
,tensor(int64)
,tensor(int8)
,tensor(string)
,tensor(uint16)
,tensor(uint32)
,tensor(uint4)
,tensor(uint64)
,tensor(uint8)
)將輸入和輸出類型限制為 IRv11 版本之前的所有張量類型。
Tind in (
tensor(int32)
,tensor(int64)
)將索引限制為整數類型
Pad - 21¶
版本¶
名稱:填充 (GitHub)
網域:
main
since_version:
21
函數:
False
支援等級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 21 起可用。
摘要¶
給定一個包含要填充的資料的張量 (data
)、一個包含每個軸的起始和結束填充值的數量的張量 (pads
)、(可選的)一個 mode
,以及(可選的)constant_value
,則會產生一個填充後的張量 (output
)。
支援的三種 modes
為(類似於 numpy.pad
支援的對應模式)
constant
(預設) - 使用由constant_value
指定的給定常數值進行填充(預設值為 0、空字串或 False)reflect
- 使用向量在每個軸的向量的第一個和最後一個值上鏡像的反射來填充edge
- 使用陣列的邊緣值進行填充wrap
- 環繞填充,如同資料張量形成一個環面
範例 1 (constant
模式)
在第二個維度的開頭插入 0 填充。
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'constant'
constant_value = 0.0
output = [
[0.0, 0.0, 1.0, 1.2],
[0.0, 0.0, 2.3, 3.4],
[0.0, 0.0, 4.5, 5.7],
]
範例 2 (reflect
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'reflect'
output = [
[1.0, 1.2, 1.0, 1.2],
[2.3, 3.4, 2.3, 3.4],
[4.5, 5.7, 4.5, 5.7],
]
範例 3 (edge
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'edge'
output = [
[1.0, 1.0, 1.0, 1.2],
[2.3, 2.3, 2.3, 3.4],
[4.5, 4.5, 4.5, 5.7],
]
範例 4 (wrap
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [2, 1, 1, 1]
mode = 'wrap'
output = [
[3.4, 2.3, 3.4, 2.3],
[5.7, 4.5, 5.7, 4.5],
[1.2, 1.0, 1.2, 1.0],
[3.4, 2.3, 3.4, 2.3],
[5.7, 4.5, 5.7, 4.5],
[1.2, 1.0, 1.2, 1.0],
]
屬性¶
mode - STRING(預設為
'constant'
)支援的模式:
constant
(預設)、reflect
、edge
、wrap
輸入¶
介於 2 和 4 個輸入之間。
data (異質) - T
輸入張量。
pads (異質) - tensor(int64)
整數張量,表示在每個軸的開頭和結尾處新增或移除(如果為負數)的填充元素數。對於 2D 輸入張量,它是像素的數量。
pads
應為形狀 [2 * num_axes] 的 1D 張量,其中num_axes
是指axes
輸入中的元素數,如果未明確提供axes
,則是指輸入的階數。pads
格式應為:[x1_begin, x2_begin, …, x1_end, x2_end,…],其中 xi_begin 是在軸axes[i]
開頭新增的填充值數量,而 xi_end 是在軸axes[i]
結尾新增的填充值數量。constant_value (可選,異質) - T
(可選)如果選擇的模式為
constant
,則要使用的純量值(預設為 0、空字串或 False)。axes (可選,異質) - Tind
pads
應用於的軸的 1 維張量。負值表示從後面計算維度。接受範圍為 [-r, r-1],其中 r = rank(data)。如果重複軸,則行為未定義。如果未提供,則假設所有軸 ([0, 1, ..., input_rank-1]
)。
輸出¶
output (異質) - T
填充後的張量。
類型約束¶
T in (
tensor(bfloat16)
,tensor(bool)
,tensor(complex128)
,tensor(complex64)
,tensor(double)
,tensor(float)
,tensor(float16)
,tensor(float8e4m3fn)
,tensor(float8e4m3fnuz)
,tensor(float8e5m2)
,tensor(float8e5m2fnuz)
,tensor(int16)
,tensor(int32)
,tensor(int4)
,tensor(int64)
,tensor(int8)
,tensor(string)
,tensor(uint16)
,tensor(uint32)
,tensor(uint4)
,tensor(uint64)
,tensor(uint8)
)將輸入和輸出類型限制為 IRv10 版本之前的所有張量類型。
Tind in (
tensor(int32)
,tensor(int64)
)將索引限制為整數類型
Pad - 19¶
版本¶
名稱:填充 (GitHub)
網域:
main
since_version:
19
函數:
False
支援等級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 19 起可用。
摘要¶
給定一個包含要填充的資料的張量 (data
)、一個包含每個軸的起始和結束填充值的數量的張量 (pads
)、(可選的)一個 mode
,以及(可選的)constant_value
,則會產生一個填充後的張量 (output
)。
支援的三種 modes
為(類似於 numpy.pad
支援的對應模式)
constant
(預設) - 使用由constant_value
指定的給定常數值進行填充(預設值為 0、空字串或 False)reflect
- 使用向量在每個軸的向量的第一個和最後一個值上鏡像的反射來填充edge
- 使用陣列的邊緣值進行填充wrap
- 環繞填充,如同資料張量形成一個環面
範例 1 (constant
模式)
在第二個維度的開頭插入 0 填充。
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'constant'
constant_value = 0.0
output = [
[0.0, 0.0, 1.0, 1.2],
[0.0, 0.0, 2.3, 3.4],
[0.0, 0.0, 4.5, 5.7],
]
範例 2 (reflect
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'reflect'
output = [
[1.0, 1.2, 1.0, 1.2],
[2.3, 3.4, 2.3, 3.4],
[4.5, 5.7, 4.5, 5.7],
]
範例 3 (edge
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'edge'
output = [
[1.0, 1.0, 1.0, 1.2],
[2.3, 2.3, 2.3, 3.4],
[4.5, 4.5, 4.5, 5.7],
]
範例 4 (wrap
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [2, 1, 1, 1]
mode = 'wrap'
output = [
[3.4, 2.3, 3.4, 2.3],
[5.7, 4.5, 5.7, 4.5],
[1.2, 1.0, 1.2, 1.0],
[3.4, 2.3, 3.4, 2.3],
[5.7, 4.5, 5.7, 4.5],
[1.2, 1.0, 1.2, 1.0],
]
屬性¶
mode - STRING(預設為
'constant'
)支援的模式:
constant
(預設)、reflect
、edge
、wrap
輸入¶
介於 2 和 4 個輸入之間。
data (異質) - T
輸入張量。
pads (異質) - tensor(int64)
整數張量,表示在每個軸的開頭和結尾處新增或移除(如果為負數)的填充元素數。對於 2D 輸入張量,它是像素的數量。
pads
應為形狀 [2 * num_axes] 的 1D 張量,其中num_axes
是指axes
輸入中的元素數,如果未明確提供axes
,則是指輸入的階數。pads
格式應為:[x1_begin, x2_begin, …, x1_end, x2_end,…],其中 xi_begin 是在軸axes[i]
開頭新增的填充值數量,而 xi_end 是在軸axes[i]
結尾新增的填充值數量。constant_value (可選,異質) - T
(可選)如果選擇的模式為
constant
,則要使用的純量值(預設為 0、空字串或 False)。axes (可選,異質) - Tind
pads
應用於的軸的 1 維張量。負值表示從後面計算維度。接受範圍為 [-r, r-1],其中 r = rank(data)。如果重複軸,則行為未定義。如果未提供,則假設所有軸 ([0, 1, ..., input_rank-1]
)。
輸出¶
output (異質) - T
填充後的張量。
類型約束¶
T in (
tensor(bfloat16)
,tensor(bool)
,tensor(complex128)
,tensor(complex64)
,tensor(double)
,tensor(float)
,tensor(float16)
,tensor(int16)
,tensor(int32)
,tensor(int64)
,tensor(int8)
,tensor(string)
,tensor(uint16)
,tensor(uint32)
,tensor(uint64)
,tensor(uint8)
)將輸入和輸出類型限制為所有張量類型。
Tind in (
tensor(int32)
,tensor(int64)
)將索引限制為整數類型
Pad - 18¶
版本¶
名稱:填充 (GitHub)
網域:
main
since_version:
18
函數:
False
支援等級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 18 起可用。
摘要¶
給定一個包含要填充的資料的張量 (data
)、一個包含每個軸的起始和結束填充值的數量的張量 (pads
)、(可選的)一個 mode
,以及(可選的)constant_value
,則會產生一個填充後的張量 (output
)。
支援的三種 modes
為(類似於 numpy.pad
支援的對應模式)
constant
(預設) - 使用由constant_value
指定的給定常數值進行填充(預設值為 0、空字串或 False)reflect
- 使用向量在每個軸的向量的第一個和最後一個值上鏡像的反射來填充edge
- 使用陣列的邊緣值進行填充
範例 1 (constant
模式)
在第二個維度的開頭插入 0 填充。
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'constant'
constant_value = 0.0
output = [
[0.0, 0.0, 1.0, 1.2],
[0.0, 0.0, 2.3, 3.4],
[0.0, 0.0, 4.5, 5.7],
]
範例 2 (reflect
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'reflect'
output = [
[1.0, 1.2, 1.0, 1.2],
[2.3, 3.4, 2.3, 3.4],
[4.5, 5.7, 4.5, 5.7],
]
範例 3 (edge
模式)
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
pads = [0, 2, 0, 0]
mode = 'edge'
output = [
[1.0, 1.0, 1.0, 1.2],
[2.3, 2.3, 2.3, 3.4],
[4.5, 4.5, 4.5, 5.7],
]
屬性¶
mode - STRING(預設為
'constant'
)支援的模式:
constant
(預設)、reflect
、edge
輸入¶
介於 2 和 4 個輸入之間。
data (異質) - T
輸入張量。
pads (異質) - tensor(int64)
整數張量,表示在每個軸的開頭和結尾處新增或移除(如果為負數)的填充元素數。對於 2D 輸入張量,它是像素的數量。
pads
應為形狀 [2 * num_axes] 的 1D 張量,其中num_axes
是指axes
輸入中的元素數,如果未明確提供axes
,則是指輸入的階數。pads
格式應為:[x1_begin, x2_begin, …, x1_end, x2_end,…],其中 xi_begin 是在軸axes[i]
開頭新增的填充值數量,而 xi_end 是在軸axes[i]
結尾新增的填充值數量。constant_value (可選,異質) - T
(可選)如果選擇的模式為
constant
,則要使用的純量值(預設為 0、空字串或 False)。axes (可選,異質) - Tind
pads
應用於的軸的 1 維張量。負值表示從後面計算維度。接受範圍為 [-r, r-1],其中 r = rank(data)。如果重複軸,則行為未定義。如果未提供,則假設所有軸 ([0, 1, ..., input_rank-1]
)。
輸出¶
output (異質) - T
填充後的張量。
類型約束¶
T in (
tensor(bfloat16)
,tensor(bool)
,tensor(complex128)
,tensor(complex64)
,tensor(double)
,tensor(float)
,tensor(float16)
,tensor(int16)
,tensor(int32)
,tensor(int64)
,tensor(int8)
,tensor(string)
,tensor(uint16)
,tensor(uint32)
,tensor(uint64)
,tensor(uint8)
)將輸入和輸出類型限制為所有張量類型。
Tind in (
tensor(int32)
,tensor(int64)
)將索引限制為整數類型
Pad - 13¶
版本¶
名稱:填充 (GitHub)
網域:
main
since_version:
13
函數:
False
支援等級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 13 起可用。
摘要¶
給定一個包含要填充的資料的張量 (data
)、一個包含每個軸的起始和結束填充值的數量的張量 (pads
)、(可選的)一個 mode
,以及(可選的)constant_value
,則會產生一個填充後的張量 (output
)。
支援的三種 modes
為(類似於 numpy.pad
支援的對應模式)
constant
(預設) - 使用由constant_value
指定的給定常數值進行填充(預設值為 0、空字串或 False)reflect
- 使用向量在每個軸的向量的第一個和最後一個值上鏡像的反射來填充edge
- 使用陣列的邊緣值進行填充
範例 1 (constant
模式):在第二個維度的開頭插入 0 填充。
data = [ [1.0, 1.2], [2.3, 3.4], [4.5, 5.7], ]
pads = [0, 2, 0, 0]
mode = ‘constant’
constant_value = 0.0
output = [ [0.0, 0.0, 1.0, 1.2], [0.0, 0.0, 2.3, 3.4], [0.0, 0.0, 4.5, 5.7], ]
範例 2 (reflect
模式):data = [ [1.0, 1.2], [2.3, 3.4], [4.5, 5.7], ]
pads = [0, 2, 0, 0]
mode = ‘reflect’
output = [ [1.0, 1.2, 1.0, 1.2], [2.3, 3.4, 2.3, 3.4], [4.5, 5.7, 4.5, 5.7], ]
範例 3 (edge
模式):data = [ [1.0, 1.2], [2.3, 3.4], [4.5, 5.7], ]
pads = [0, 2, 0, 0]
mode = ‘edge’
output = [ [1.0, 1.0, 1.0, 1.2], [2.3, 2.3, 2.3, 3.4], [4.5, 4.5, 4.5, 5.7], ]
屬性¶
mode - STRING(預設為
'constant'
)支援的模式:
constant
(預設)、reflect
、edge
輸入¶
介於 2 到 3 個輸入之間。
data (異質) - T
輸入張量。
pads (異質) - tensor(int64)
整數張量,表示在每個軸的開頭和結尾要新增或移除(如果為負數)的填充元素數量。對於 2D 輸入張量,它是像素數。
pads
應該是形狀為 [2 * input_rank] 的 1D 張量。pads
的格式應為:[x1_begin, x2_begin,…,x1_end, x2_end,…],其中 xi_begin 是在軸i
的開頭新增的填充值數量,而 xi_end 是在軸i
的結尾新增的填充值數量。constant_value (可選,異質) - T
(可選)如果選擇的模式為
constant
,則要使用的純量值(預設為 0、空字串或 False)。
輸出¶
output (異質) - T
填充後的張量。
類型約束¶
T in (
tensor(bfloat16)
,tensor(bool)
,tensor(complex128)
,tensor(complex64)
,tensor(double)
,tensor(float)
,tensor(float16)
,tensor(int16)
,tensor(int32)
,tensor(int64)
,tensor(int8)
,tensor(string)
,tensor(uint16)
,tensor(uint32)
,tensor(uint64)
,tensor(uint8)
)將輸入和輸出類型限制為所有張量類型。
Pad - 11¶
版本¶
名稱:填充 (GitHub)
網域:
main
since_version:
11
函數:
False
支援等級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 11 起可用。
摘要¶
給定一個包含要填充的資料的張量 (data
)、一個包含每個軸的起始和結束填充值的數量的張量 (pads
)、(可選的)一個 mode
,以及(可選的)constant_value
,則會產生一個填充後的張量 (output
)。
支援的三種 modes
為(類似於 numpy.pad
支援的對應模式)
constant
(預設) - 使用由constant_value
指定的給定常數值進行填充(預設為 0)reflect
- 使用向量在每個軸的向量的第一個和最後一個值上鏡像的反射來填充edge
- 使用陣列的邊緣值進行填充
範例 1 (constant
模式):在第二個維度的開頭插入 0 填充。
data = [ [1.0, 1.2], [2.3, 3.4], [4.5, 5.7], ]
pads = [0, 2, 0, 0]
mode = ‘constant’
constant_value = 0.0
output = [ [0.0, 0.0, 1.0, 1.2], [0.0, 0.0, 2.3, 3.4], [0.0, 0.0, 4.5, 5.7], ]
範例 2 (reflect
模式):data = [ [1.0, 1.2], [2.3, 3.4], [4.5, 5.7], ]
pads = [0, 2, 0, 0]
mode = ‘reflect’
output = [ [1.0, 1.2, 1.0, 1.2], [2.3, 3.4, 2.3, 3.4], [4.5, 5.7, 4.5, 5.7], ]
範例 3 (edge
模式):data = [ [1.0, 1.2], [2.3, 3.4], [4.5, 5.7], ]
pads = [0, 2, 0, 0]
mode = ‘edge’
output = [ [1.0, 1.0, 1.0, 1.2], [2.3, 2.3, 2.3, 3.4], [4.5, 4.5, 4.5, 5.7], ]
屬性¶
mode - STRING(預設為
'constant'
)支援的模式:
constant
(預設)、reflect
、edge
輸入¶
介於 2 到 3 個輸入之間。
data (異質) - T
輸入張量。
pads (異質) - tensor(int64)
整數張量,表示在每個軸的開頭和結尾要新增或移除(如果為負數)的填充元素數量。對於 2D 輸入張量,它是像素數。
pads
應該是形狀為 [2 * input_rank] 的 1D 張量。pads
的格式應為:[x1_begin, x2_begin,…,x1_end, x2_end,…],其中 xi_begin 是在軸i
的開頭新增的填充值數量,而 xi_end 是在軸i
的結尾新增的填充值數量。constant_value (可選,異質) - T
(可選)如果選擇的模式為
constant
,則要使用的純量值(預設為 0)。
輸出¶
output (異質) - T
填充後的張量。
類型約束¶
T in (
tensor(double)
,tensor(float)
,tensor(float16)
,tensor(int16)
,tensor(int32)
,tensor(int64)
,tensor(int8)
,tensor(uint16)
,tensor(uint32)
,tensor(uint64)
,tensor(uint8)
)將輸入和輸出限制為僅限數值類型。
Pad - 2¶
版本¶
名稱:填充 (GitHub)
網域:
main
since_version:
2
函數:
False
支援等級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 2 起可用。
摘要¶
給定 data
張量、填充、模式和值。範例:在第二個維度的開頭插入 0 填充。data = [ [1.0, 1.2], [2.3, 3.4], [4.5, 5.7], ] pads = [0, 2, 0, 0] output = [ [ [0.0, 0.0, 1.0, 1.2], [0.0, 0.0, 2.3, 3.4], [0.0, 0.0, 4.5, 5.7], ], ]
屬性¶
mode - STRING(預設為
'constant'
)三種模式:constant(預設)、reflect、edge
pads - INTS(必要)
整數列表,表示在每個軸的開頭和結尾添加或移除(如果為負數)的填充元素數量。對於 2D,它是像素的數量。
pads
的秩應為輸入秩的兩倍。pads
的格式應如下:[x1_begin, x2_begin…x1_end, x2_end,…],其中 xi_begin 是在軸i
的開頭添加的像素數,而 xi_end 是在軸i
的結尾添加的像素數。value - FLOAT (預設值為
'0.0'
)單精度浮點數,表示要填充的值。
輸入¶
data (異質) - T
輸入張量。
輸出¶
output (異質) - T
填充後的張量。
類型約束¶
T 屬於 (
tensor(double)
,tensor(float)
,tensor(float16)
)將輸入和輸出類型限制為浮點數張量。
Pad - 1¶
版本¶
名稱:填充 (GitHub)
網域:
main
since_version:
1
函數:
False
支援等級:
SupportType.COMMON
形狀推斷:
False
此版本的運算符自版本 1 開始可用。
摘要¶
給定 data
張量、填充、模式和值。範例:在第二個維度的開頭插入 0 填充。data = [ [1.0, 1.2], [2.3, 3.4], [4.5, 5.7], ] paddings = [0, 0, 2, 0] output = [ [ [0.0, 0.0, 1.0, 1.2], [0.0, 0.0, 2.3, 3.4], [0.0, 0.0, 4.5, 5.7], ], ]
屬性¶
mode - STRING(預設為
'constant'
)三種模式:constant(預設)、reflect、edge
paddings - INTS (必需)
整數列表,表示在每個軸的開頭和結尾的填充元素計數,對於 2D,它是像素的數量。
paddings
的秩應為輸入秩的兩倍。paddings
的格式應如下:[x1_begin, x2_begin…x1_end, x2_end,…],其中 xi_begin 是在軸i
的開頭添加的像素數,而 xi_end 是在軸i
的結尾添加的像素數。value - FLOAT (預設值為
'0.0'
)單精度浮點數,表示要填充的值,預設值為 0。
輸入¶
data (異質) - T
輸入張量。
輸出¶
output (異質) - T
填充後的張量。
類型約束¶
T 屬於 (
tensor(double)
,tensor(float)
,tensor(float16)
)將輸入和輸出類型限制為浮點數張量。