Pad¶
Pad - 23¶
版本¶
**名称**: Pad (GitHub)
**域**:
main
**起始版本**:
23
**函数**:
False
**支持级别**:
SupportType.COMMON
**形状推断**:
True
此版本的运算符已可用 **自版本 23 起**。
摘要¶
给定一个包含要填充的数据的张量 (data
),一个包含每个轴的起始和结束填充值数量的张量 (pads
),(可选地)一个 mode
,以及(可选地)constant_value
,将生成一个填充后的张量 (output
)。
支持的三种 mode
是(类似于 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 - 字符串**(默认为
'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-D 张量。负值表示从后向前计算维度。可接受的范围是 [-r, r-1],其中 r = rank(data)。如果轴重复,行为未定义。如果未提供,则假定为所有轴 ([0, 1, ..., input_rank-1]
)。
输出¶
**output**(异构)- **T**
填充后的张量。
类型约束¶
**T** 在 (
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** 在 (
tensor(int32)
,tensor(int64)
) 中将索引约束为整数类型
Pad - 21¶
版本¶
**名称**: Pad (GitHub)
**域**:
main
**起始版本**:
21
**函数**:
False
**支持级别**:
SupportType.COMMON
**形状推断**:
True
此版本的运算符已可用 **自版本 21 起**。
摘要¶
给定一个包含要填充的数据的张量 (data
),一个包含每个轴的起始和结束填充值数量的张量 (pads
),(可选地)一个 mode
,以及(可选地)constant_value
,将生成一个填充后的张量 (output
)。
支持的三种 mode
是(类似于 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 - 字符串**(默认为
'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-D 张量。负值表示从后向前计算维度。可接受的范围是 [-r, r-1],其中 r = rank(data)。如果轴重复,行为未定义。如果未提供,则假定为所有轴 ([0, 1, ..., input_rank-1]
)。
输出¶
**output**(异构)- **T**
填充后的张量。
类型约束¶
**T** 在 (
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** 在 (
tensor(int32)
,tensor(int64)
) 中将索引约束为整数类型
Pad - 19¶
版本¶
**名称**: Pad (GitHub)
**域**:
main
**起始版本**:
19
**函数**:
False
**支持级别**:
SupportType.COMMON
**形状推断**:
True
此版本的运算符已可用 **自版本 19 起**。
摘要¶
给定一个包含要填充的数据的张量 (data
),一个包含每个轴的起始和结束填充值数量的张量 (pads
),(可选地)一个 mode
,以及(可选地)constant_value
,将生成一个填充后的张量 (output
)。
支持的三种 mode
是(类似于 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 - 字符串**(默认为
'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-D 张量。负值表示从后向前计算维度。可接受的范围是 [-r, r-1],其中 r = rank(data)。如果轴重复,行为未定义。如果未提供,则假定为所有轴 ([0, 1, ..., input_rank-1]
)。
输出¶
**output**(异构)- **T**
填充后的张量。
类型约束¶
**T** 在 (
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** 在 (
tensor(int32)
,tensor(int64)
) 中将索引约束为整数类型
Pad - 18¶
版本¶
**名称**: Pad (GitHub)
**域**:
main
**起始版本**:
18
**函数**:
False
**支持级别**:
SupportType.COMMON
**形状推断**:
True
此版本的运算符已可用 **自版本 18 起**。
摘要¶
给定一个包含要填充的数据的张量 (data
),一个包含每个轴的起始和结束填充值数量的张量 (pads
),(可选地)一个 mode
,以及(可选地)constant_value
,将生成一个填充后的张量 (output
)。
支持的三种 mode
是(类似于 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 - 字符串**(默认为
'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-D 张量。负值表示从后向前计算维度。可接受的范围是 [-r, r-1],其中 r = rank(data)。如果轴重复,行为未定义。如果未提供,则假定为所有轴 ([0, 1, ..., input_rank-1]
)。
输出¶
**output**(异构)- **T**
填充后的张量。
类型约束¶
**T** 在 (
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** 在 (
tensor(int32)
,tensor(int64)
) 中将索引约束为整数类型
Pad - 13¶
版本¶
**名称**: Pad (GitHub)
**域**:
main
**起始版本**:
13
**函数**:
False
**支持级别**:
SupportType.COMMON
**形状推断**:
True
此版本的运算符已可用 **自版本 13 起**。
摘要¶
给定一个包含要填充的数据的张量 (data
),一个包含每个轴的起始和结束填充值数量的张量 (pads
),(可选地)一个 mode
,以及(可选地)constant_value
,将生成一个填充后的张量 (output
)。
支持的三种 mode
是(类似于 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 - 字符串**(默认为
'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** 在 (
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¶
版本¶
**名称**: Pad (GitHub)
**域**:
main
**起始版本**:
11
**函数**:
False
**支持级别**:
SupportType.COMMON
**形状推断**:
True
此版本的运算符已可用 **自版本 11 起**。
摘要¶
给定一个包含要填充的数据的张量 (data
),一个包含每个轴的起始和结束填充值数量的张量 (pads
),(可选地)一个 mode
,以及(可选地)constant_value
,将生成一个填充后的张量 (output
)。
支持的三种 mode
是(类似于 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 - 字符串**(默认为
'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** 在 (
tensor(double)
,tensor(float)
,tensor(float16)
,tensor(int16)
,tensor(int32)
,tensor(int64)
,tensor(int8)
,tensor(uint16)
,tensor(uint32)
,tensor(uint64)
,tensor(uint8)
) 中将输入和输出约束为仅数值类型。
Pad - 2¶
版本¶
**名称**: Pad (GitHub)
**域**:
main
**起始版本**:
2
**函数**:
False
**支持级别**:
SupportType.COMMON
**形状推断**:
True
此版本的运算符已可用 **自版本 2 起**。
摘要¶
给定 data
张量、pads、mode 和 value。示例:在第二维的开头插入 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 - 字符串**(默认为
'constant'
)三种模式:constant(默认)、reflect、edge
**pads - 整数列表**(必需)
一个整数列表,指示在每个轴的开始和结束处添加或移除(如果为负)的填充元素的数量。对于 2D,它是像素数量。
pads
的秩应为输入秩的两倍。pads
的格式应如下所示:[x1_begin, x2_begin…x1_end, x2_end,…],其中 xi_begin 是在轴i
的开头添加的像素数量,xi_end 是在轴i
的结尾添加的像素数量。**value - 浮点数**(默认为
'0.0'
)一个浮点数,指示要填充的值。
输入¶
**data**(异构)- **T**
输入张量。
输出¶
**output**(异构)- **T**
填充后的张量。
类型约束¶
**T** 在 (
tensor(double)
,tensor(float)
,tensor(float16)
) 中将输入和输出类型约束为浮点张量。
Pad - 1¶
版本¶
**名称**: Pad (GitHub)
**域**:
main
**起始版本**:
1
**函数**:
False
**支持级别**:
SupportType.COMMON
**形状推断**:
False
此版本的运算符已可用 **自版本 1 起**。
摘要¶
给定 data
张量、paddings、mode 和 value。示例:在第二维的开头插入 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 - 字符串**(默认为
'constant'
)三种模式:constant(默认)、reflect、edge
**paddings - 整数列表**(必需)
一个整数列表,指示在每个轴的开始和结束处的填充元素数量,对于 2D,它是像素数量。
paddings
的秩应为输入秩的两倍。paddings
的格式应如下所示:[x1_begin, x2_begin…x1_end, x2_end,…],其中 xi_begin 是在轴i
的开头添加的像素数量,xi_end 是在轴i
的结尾添加的像素数量。**value - 浮点数**(默认为
'0.0'
)一个浮点数,指示要填充的值,默认为 0
输入¶
**data**(异构)- **T**
输入张量。
输出¶
**output**(异构)- **T**
填充后的张量。
类型约束¶
**T** 在 (
tensor(double)
,tensor(float)
,tensor(float16)
) 中将输入和输出类型约束为浮点张量。