Gather¶
Gather - 13¶
版本¶
網域:
main
since_version:
13
函數:
False
支援層級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 13 起可用。
摘要¶
給定一個等級 r >= 1 的 data
張量,和一個等級 q 的 indices
張量,收集由 indices
索引的 data
的軸維度項目(預設為最外層軸 axis=0),並將它們串連成一個等級為 q + (r - 1) 的輸出張量。
如果 axis = 0
,則令 k = indices[i_{0}, ..., i_{q-1}]
,則 output[i_{0}, ..., i_{q-1}, j_{0}, ..., j_{r-2}] = input[k , j_{0}, ..., j_{r-2}]
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
indices = [
[0, 1],
[1, 2],
]
output = [
[
[1.0, 1.2],
[2.3, 3.4],
],
[
[2.3, 3.4],
[4.5, 5.7],
],
]
如果 axis = 1
,則令 k = indices[i_{0}, ..., i_{q-1}]
,則 output[j_{0}, i_{0}, ..., i_{q-1}, j_{1}, ..., j_{r-2}] = input[j_{0}, k, j_{1}, ..., j_{r-2}]
data = [
[1.0, 1.2, 1.9],
[2.3, 3.4, 3.9],
[4.5, 5.7, 5.9],
]
indices = [
[0, 2],
]
axis = 1,
output = [
[[1.0, 1.9]],
[[2.3, 3.9]],
[[4.5, 5.9]],
]
屬性¶
axis - INT(預設值為
'0'
)要在哪個軸上收集。負值表示從後方開始計算維度。接受的範圍是 [-r, r-1],其中 r = rank(data)。
輸入¶
data (異質) - T
等級 r >= 1 的張量。
indices (異質) - Tind
任何等級 q 的 int32/int64 索引張量。所有索引值都預期在沿大小為 s 的軸的範圍 [-s, s-1] 內。如果任何索引值超出範圍,則會發生錯誤。
輸出¶
output (異質) - T
等級為 q + (r - 1) 的張量。
類型約束¶
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)
)將索引限制為整數類型
Gather - 11¶
版本¶
網域:
main
since_version:
11
函數:
False
支援層級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 11 起可用。
摘要¶
給定一個等級 r >= 1 的 data
張量,和一個等級 q 的 indices
張量,收集由 indices
索引的 data
的軸維度項目(預設為最外層軸 axis=0),並將它們串連成一個等級為 q + (r - 1) 的輸出張量。
axis = 0
令 k = indices[i_{0}, …, i_{q-1}]。則 output[i_{0}, …, i_{q-1}, j_{0}, …, j_{r-2}] = input[k , j_{0}, …, j_{r-2}]
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
indices = [
[0, 1],
[1, 2],
]
output = [
[
[1.0, 1.2],
[2.3, 3.4],
],
[
[2.3, 3.4],
[4.5, 5.7],
],
]
axis = 1
令 k = indices[i_{0}, …, i_{q-1}]。則 output[j_{0}, i_{0}, …, i_{q-1}, j_{1}, …, j_{r-2}] = input[j_{0}, k, j_{1}, …, j_{r-2}]
data = [
[1.0, 1.2, 1.9],
[2.3, 3.4, 3.9],
[4.5, 5.7, 5.9],
]
indices = [
[0, 2],
]
axis = 1,
output = [
[[1.0, 1.9]],
[[2.3, 3.9]],
[[4.5, 5.9]],
]
屬性¶
axis - INT(預設值為
'0'
)要在哪個軸上收集。負值表示從後方開始計算維度。接受的範圍是 [-r, r-1],其中 r = rank(data)。
輸入¶
data (異質) - T
等級 r >= 1 的張量。
indices (異質) - Tind
任何等級 q 的 int32/int64 索引張量。所有索引值都預期在沿大小為 s 的軸的範圍 [-s, s-1] 內。如果任何索引值超出範圍,則會發生錯誤。
輸出¶
output (異質) - T
等級為 q + (r - 1) 的張量。
類型約束¶
T in (
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)
)將索引限制為整數類型
Gather - 1¶
版本¶
網域:
main
since_version:
1
函數:
False
支援層級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 1 起可用。
摘要¶
給定一個等級 r >= 1 的 data
張量,和一個等級 q 的 indices
張量,收集由 indices
索引的 data
的軸維度項目(預設為最外層軸 axis=0),並將它們串連成一個等級為 q + (r - 1) 的輸出張量。範例 1
data = [
[1.0, 1.2],
[2.3, 3.4],
[4.5, 5.7],
]
indices = [
[0, 1],
[1, 2],
]
output = [
[
[1.0, 1.2],
[2.3, 3.4],
],
[
[2.3, 3.4],
[4.5, 5.7],
],
]
範例 2
data = [
[1.0, 1.2, 1.9],
[2.3, 3.4, 3.9],
[4.5, 5.7, 5.9],
]
indices = [
[0, 2],
]
axis = 1,
output = [
[[1.0, 1.9]],
[[2.3, 3.9]],
[[4.5, 5.9]],
]
屬性¶
axis - INT(預設值為
'0'
)要在哪個軸上收集。負值表示從後方開始計算維度。接受的範圍是 [-r, r-1]
輸入¶
data (異質) - T
等級 r >= 1 的張量。
indices (異質) - Tind
任何等級 q 的 int32/int64 索引張量。所有索引值都預期在範圍內。如果任何索引值超出範圍,則會發生錯誤。
輸出¶
output (異質) - T
等級為 q + (r - 1) 的張量。
類型約束¶
T in (
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)
)將索引限制為整數類型