'chlo' Dialect

Client HLO Ops

這個方言包含的運算子與 XlaBuilder C++ API 的 API 介面區域密切相關,這些運算子的語意超出較低層級方言 (例如 stablehlo) 的範圍。基本上,每當用戶端程式庫使用語法糖或多個運算子的組合進行 API 呼叫時,這個方言會嘗試模擬 API 呼叫,並提供轉換模式,以便完全具體化為較低層級的方言。

作業

chlo._asin_acos_kernel (chlo::AsinAcosKernelOp)

AsinAcosKernel 運算子

語法:

operation ::= `chlo._asin_acos_kernel` $operand attr-dict `:` type($operand) `->` type($result)

傳回 AsinAcosKernel(operand) 元素。

If
  w = _asin_acos_kernel(z)
  w' = _asin_acos_kernel(I * z)
Then
  asin(z) = complex(atan2(z.real, w.real), sign(z.imag) * w.imag)
  acos(z) = complex(atan2(w.real, z.real), -sign(z.imag) * w.imag)
  asinh(z) = complex(sign(z.real) * w'.imag, atan2(z.imag, w'.real))
  acosh(z) = complex(w.imag, sign(z.imag) * atan2(w.real, z.real))

這個運算子會做為分解作業的中間值,且架構絕不應直接建構這個運算子,後端也不應使用這個運算子。

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的複合型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的複合型別張量

chlo.acos (chlo::AcosOp)

Acos 運算子

語法:

operation ::= `chlo.acos` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Acos(operand) 元素。

\[ \acos(x) = 2 * \atan(\sqrt(1 - x^2) / (1 + x)) if x != -1 = pi if x == -1 \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.acosh (chlo::AcoshOp)

Acosh 作業

語法:

operation ::= `chlo.acosh` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Acosh(operand) 元素。

\[ \acosh(x) = log(x + sqrt(x^2 - 1)) if x >= -1 \acosh(x) = nan if x < -1 \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.asin (chlo::AsinOp)

Asin 運算子

語法:

operation ::= `chlo.asin` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Asin(operand) 元素。

\[ \asin(x) = 2 * atan(x / (1 + sqrt(1 - x^2))) \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.asinh (chlo::AsinhOp)

Asinh 運算

語法:

operation ::= `chlo.asinh` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Asinh(operand) 元素。

\[ \asinh(x) = log(x + sqrt(x^2 + 1)) \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.atan (chlo::AtanOp)

Atan 運算子

語法:

operation ::= `chlo.atan` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Atan(operand) 元素。

\[ \atan(x) = \atan2(x, 1) \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.atanh (chlo::AtanhOp)

Atanh 運算子

語法:

operation ::= `chlo.atanh` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Atanh(operand) 元素。

\[ \atanh(x) = 0.5 * log((1 + x) / (1 - x)) if abs(x) <= 1 = nan otherwise \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.bessel_i1e (chlo::BesselI1eOp)

1 階貝塞爾函式

語法:

operation ::= `chlo.bessel_i1e` $operand attr-dict `:` type($operand) `->` type($result)

傳回 bessel_i1e(operand) 元素。

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.broadcast_add (chlo::BroadcastAddOp)

加法運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_add` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs + rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingCommutativeHLO_BroadcastingElementwiseHLO_CompatibleOperandsAndResultElementTypeInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_and (chlo::BroadcastAndOp)

邏輯 AND 運算子 (可選擇是否要廣播)

語法:

operation ::= `chlo.broadcast_and` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 logical_and(lhs, rhs) 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingCommutativeHLO_BroadcastingElementwiseInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 布林值或 2/4/8/16/32/64 位元整數值的張量
rhs 布林值或 2/4/8/16/32/64 位元整數值的張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_atan2 (chlo::BroadcastAtan2Op)

Atan2 運算子 (可選擇是否要廣播)

語法:

operation ::= `chlo.broadcast_atan2` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 atan2(lhs/rhs) 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_compare (chlo::BroadcastCompareOp)

比較運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_compare` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

根據 comparison_directioncompare_type,逐一比較 lhsrhs 的元素。如未指定,浮點元素類型為 compare_type,已簽署元素類型為 SIGNED,未簽署元素類型為 UNSIGNED。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_comparison_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性
comparison_direction::mlir::chlo::ComparisonDirectionAttr要執行的比較作業。
compare_type::mlir::chlo::ComparisonTypeAttr要使用的比較類型。

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 布林值張量

chlo.broadcast_complex (chlo::BroadcastComplexOp)

複雜運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_complex` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

將一對實數和虛數值逐一轉換為複數值。

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點值的張量
rhs 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
「未命名」 具有 32/64 位元浮點元素值的複合型別張量

chlo.broadcast_divide (chlo::BroadcastDivOp)

除法運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_divide` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs / rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_maximum (chlo::BroadcastMaxOp)

最多 1 位操作人員 (可選用廣播功能)

語法:

operation ::= `chlo.broadcast_maximum` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 max(lhs, rhs) 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingCommutativeHLO_BroadcastingElementwiseHLO_CompatibleOperandsAndResultElementTypeInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_minimum (chlo::BroadcastMinOp)

最低運算子 (可選擇是否要廣播)

語法:

operation ::= `chlo.broadcast_minimum` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 min(lhs, rhs) 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingCommutativeHLO_BroadcastingElementwiseHLO_CompatibleOperandsAndResultElementTypeInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_multiply (chlo::BroadcastMulOp)

乘法運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_multiply` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs * rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingCommutativeHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_next_after (chlo::BroadcastNextAfterOp)

Std::nextafter 運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_next_after` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs 的下一個可表示值 (以元素為單位),方向為 rhs。也可以傳回次常數。

此函式的作用等同於 C++ std::nextafter 函式。

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_or (chlo::BroadcastOrOp)

邏輯 OR 運算子 (可選擇是否要廣播)

語法:

operation ::= `chlo.broadcast_or` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 logical_or(lhs, rhs) 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingCommutativeHLO_BroadcastingElementwiseInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 布林值或 2/4/8/16/32/64 位元整數值的張量
rhs 布林值或 2/4/8/16/32/64 位元整數值的張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_polygamma (chlo::BroadcastPolygammaOp)

多重 Gamma 函式 (可選用廣播)

語法:

operation ::= `chlo.broadcast_polygamma` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 Polygamma(operand, operand) 元素。

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_power (chlo::BroadcastPowOp)

電源運算子 (可選擇是否要廣播)

語法:

operation ::= `chlo.broadcast_power` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs ^ rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_remainder (chlo::BroadcastRemOp)

餘數運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_remainder` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs % rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_select (chlo::BroadcastSelectOp)

選取運算子 (可選用 NumPy 樣式的廣播)

語法:

operation ::= `chlo.broadcast_select` $pred `,` $on_true `,` $on_false attr-dict `:`
              `(` type($pred) `,` type($on_true) `,` type($on_false) `)` `->` type(results)

根據述詞陣列的值,從兩個輸入陣列的元素建構輸出陣列。

請參閱 https://www.tensorflow.org/xla/operation_semantics#select

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
pred 布林值排序張量
on_true 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
on_false 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_shift_left (chlo::BroadcastShiftLeftOp)

左移運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_shift_left` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs << rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_shift_right_arithmetic (chlo::BroadcastShiftRightArithmeticOp)

向右位移算術運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_shift_right_arithmetic` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs >> rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_shift_right_logical (chlo::BroadcastShiftRightLogicalOp)

向右位移邏輯運算子 (可選擇是否要廣播)

語法:

operation ::= `chlo.broadcast_shift_right_logical` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs >> rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_subtract (chlo::BroadcastSubOp)

減法運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_subtract` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 lhs - rhs 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_xor (chlo::BroadcastXorOp)

邏輯 xor 運算子 (可選用廣播)

語法:

operation ::= `chlo.broadcast_xor` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 logical_xor(lhs, rhs) 元素。

請參閱 https://www.tensorflow.org/xla/operation_semantics#element-wise_binary_arithmetic_operations

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingCommutativeHLO_BroadcastingElementwiseInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 布林值或 2/4/8/16/32/64 位元整數值的張量
rhs 布林值或 2/4/8/16/32/64 位元整數值的張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.broadcast_zeta (chlo::BroadcastZetaOp)

Hurwitz zeta 函式

語法:

operation ::= `chlo.broadcast_zeta` $lhs `,` $rhs attr-dict `:`
              `(` type($lhs) `,` type($rhs) `)` `->` type(results)

傳回 Zeta(operand, operand) 元素。

\[ \(\zeta(x, q) = \sum_{n=0}^{\infty} (q + n)^{-x}\) \]

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultElementType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
broadcast_dimensions::mlir::DenseI64ArrayAttri64 密集陣列屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點值的張量
rhs 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點值的張量

chlo.conj (chlo::ConjOp)

Conj 運算子

語法:

operation ::= `chlo.conj` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Conj(operand) 元素。

\[ \conj(x) = (\real(x), \neg(\imag(x))) \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.constant (chlo::ConstantOp)

常數運算子

語法:

operation ::= `chlo.constant` attr-dict $value

代表常數值。

特徵:AlwaysSpeculatableImplTraitConstantLike

介面:ConditionallySpeculatableInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
value::mlir::ElementsAttr常數向量/張量屬性

成果:

結果 說明
output 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點數元素或每個張量整數量化值的複數型別,且形狀為靜態的張量

chlo.constant_like (chlo::ConstantLikeOp)

常數類運算子

傳回與運算元形狀相同的 splat 常數。

特徵:AlwaysSpeculatableImplTraitCHLO_BroadcastingHLO_BroadcastingElementwiseInferTensorTypeSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
value::mlir::TypedAttrTypedAttr 執行個體

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
「未命名」 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.cosh (chlo::CoshOp)

Cosh 運算子

語法:

operation ::= `chlo.cosh` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Cosh(operand) 元素。

\[ \cosh(x) = (e^x + e^-x) / 2 \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.digamma (chlo::DigammaOp)

Digamma 函式

語法:

operation ::= `chlo.digamma` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Digamma(operand) 元素。

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點值的張量

chlo.erf (chlo::ErfOp)

Erfc 運算子

語法:

operation ::= `chlo.erf` $operand attr-dict `:` type($operand) `->` type($result)

逐一計算 x 的高斯誤差函式。

erf(x) = erf_impl(x) if |x| < 1 = 1 - erfc_impl(x) otherwise

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點值的張量

chlo.erf_inv (chlo::ErfInvOp)

Inverse Erf

語法:

operation ::= `chlo.erf_inv` $operand attr-dict `:` type($operand) `->` type($result)

傳回 ErfInv(operand) 元素。

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點值的張量

chlo.erfc (chlo::ErfcOp)

Erfc 運算子

語法:

operation ::= `chlo.erfc` $operand attr-dict `:` type($operand) `->` type($result)

計算誤差函數補數 (1 - erf(x)) 的近似值。

erfc(x) = erfc_impl(x) if |x| > 1 = 1 - erf_impl(x) otherwise

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點值的張量

chlo.is_inf (chlo::IsInfOp)

IsInf 述詞

語法:

operation ::= `chlo.is_inf` $operand attr-dict `:` type($operand) `->` type($result)

傳回值是否為 +/-inf 元素。

特徵:AlwaysSpeculatableImplTraitElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 布林值張量

chlo.is_neg_inf (chlo::IsNegInfOp)

IsNegInf 述詞

語法:

operation ::= `chlo.is_neg_inf` $operand attr-dict `:` type($operand) `->` type($result)

傳回值是否為 -inf 元素。

特徵:AlwaysSpeculatableImplTraitElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 布林值張量

chlo.is_pos_inf (chlo::IsPosInfOp)

IsPosInf 述詞

語法:

operation ::= `chlo.is_pos_inf` $operand attr-dict `:` type($operand) `->` type($result)

傳回值是否為 +inf 元素。

特徵:AlwaysSpeculatableImplTraitElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 布林值張量

chlo.lgamma (chlo::LgammaOp)

Lgamma 函式

語法:

operation ::= `chlo.lgamma` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Lgamma(operand) 元素。

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點值的張量

chlo.next_after (chlo::NextAfterOp)

Std::nextafter 運算子

語法:

operation ::= `chlo.next_after` $x `,` $y attr-dict `:` type($x) `,` type($y) `->` type(results)

傳回 x 的下一個可表示值 (以元素為單位),方向為 y。也可以傳回次常數。

此函式的作用等同於 C++ std::nextafter 函式。

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
x 4/6/8/16/32/64 位元浮點值的張量
y 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點值的張量

chlo.polygamma (chlo::PolygammaOp)

多伽瑪函式

語法:

operation ::= `chlo.polygamma` $n `,` $x attr-dict `:` type($n) `,` type($x) `->` type(results)

傳回 Polygamma(operand, operand) 元素。

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
n 4/6/8/16/32/64 位元浮點值的張量
x 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點值的張量

chlo.ragged_dot (chlo::RaggedDotOp)

在單一參差不齊的維度上計算 matmul

這項作業會採用三個張量引數:lhs、rhs 和 group_sizes,以及「ragged_dot_dimension_numbers」屬性。與 dot_general 類似,lhs 和 rhs 允許任意批次和收縮維度。此外,lhs 必須有一個不規則維度,而 rhs 最多可以有一個群組維度。視左側不規則維度的種類而定,運算子有三種模式。

在模式 1 中,形狀簽章為 [b,m,k], [g,b,k,n], [b,g] -> [b,m,n]。這裡的參差不齊維度是 lhs 非收縮維度 (m)。維度 bk 分別代表批次和收縮維度。右側必須有群組維度 (g)。

在模式 2 中,形狀簽章為 [b,m,k], [b,k,n], [b,g] -> [g,b,m,n]。 這裡的參差不齊維度是左側/右側收縮維度 (k)。

在模式 3 中,形狀簽章為 [b,m,k], [b,k,n], [g] -> [b,m,n]。這裡的參差不齊維度是 LHS/RHS 批次維度 (b)。

特徵:AlwaysSpeculatableImplTrait

介面:ConditionallySpeculatableNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
ragged_dot_dimension_numbers::mlir::chlo::RaggedDotDimensionNumbersAttr此屬性會為參差不齊的點建立維度資訊模型。
precision_config::mlir::ArrayAttr精準設定屬性

運算元:

運算元 說明
lhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
rhs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
group_sizes 2/4/8/16/32/64 位元整數值的排序張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.scan (chlo::ScanOp)

掃描作業

將縮減函式 body 套用至 dimensioninits,並沿著 dimension 產生 results (包含 outputscarries)。inputs

如果 is_reverse 為 true,掃描作業會以相反順序執行。is_associative 表示縮減函式是否具備結合律。

請參閱:https://www.tensorflow.org/xla/operation_semantics#scan

ScanOp 目前沒有分解為 StableHLO 的功能。

特徵:AttrSizedOperandSegmentsAttrSizedResultSegmentsInferTensorTypeIsolatedFromAboveRecursiveMemoryEffects

介面:InferShapedTypeOpInterfaceInferTypeOpInterfaceOpAsmOpInterface

屬性:

屬性MLIR 類型說明
dimension::mlir::IntegerAttr64 位元不帶正負號整數屬性,值不得為負數
is_reverse::mlir::BoolAttrbool 屬性
is_associative::mlir::BoolAttrbool 屬性

運算元:

運算元 說明
inputs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點數元素的複數型別,或每個張量整數量化值,或每個軸整數量化值的張量變數
inits 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點數元素的複數型別,或每個張量整數量化值,或每個軸整數量化值的張量變數

成果:

結果 說明
outputs 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點數元素的複數型別,或每個張量整數量化值,或每個軸整數量化值的張量變數
carries 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點數元素的複數型別,或每個張量整數量化值,或每個軸整數量化值的張量變數

chlo.sinh (chlo::SinhOp)

Sinh 作業

語法:

operation ::= `chlo.sinh` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Sinh(operand) 元素。

\[ \sinh(x) = (e^x - e^-x) / 2 if |x| < 1 = e^(x + log(1/2)) - e^(-x + log(1/2)) otherwise. \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.square (chlo::SquareOp)

正方形運算

語法:

operation ::= `chlo.square` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Square(operand) 元素。

\[ \square(x) = complex((x.real - x.imag) * (x.real + x.imag), x.real * x.imag * 2) if x is a complex number = x * x otherwise \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.tan (chlo::TanOp)

Tan 作業

語法:

operation ::= `chlo.tan` $operand attr-dict `:` type($operand) `->` type($result)

傳回 Tan(operand) 元素。

\[ \tan(x) = \sin(x) / \cos(x) \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultTypeElementwiseSameOperandsAndResultShape

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
operand 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

成果:

結果 說明
result 具有 32/64 位元浮點元素值的 4/6/8/16/32/64 位元浮點或複數型別張量

chlo.top_k (chlo::TopKOp)

找出最後一個維度中 k 個最大元素的值和索引

語法:

operation ::= `chlo.top_k` `(`$operand `,` `k` `=` $k`)` attr-dict `:`
              type($operand) `->` `(`type($values)`,` type($indices)`)`

如果輸入內容是向量 (等級 1),則找出向量中最大的項目,並以向量形式輸出這些項目的值和索引。k因此 values[j]input 中第 j 大的項目,其索引為 indices[j]

如果是矩陣 (或更高階的輸入),則會計算每個資料列 (或沿著最後一個維度的向量) 中的前 k 個項目。因此,

values.shape = indices.shape = input.shape[:-1] + [k]

如果兩個元素相等,系統會先顯示索引較低的元素。

特徵:AlwaysSpeculatableImplTraitInferTensorType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

屬性:

屬性MLIR 類型說明
k::mlir::IntegerAttr64 位元無符號整數屬性

運算元:

運算元 說明
operand 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

成果:

結果 說明
values 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量
indices 4/6/8/16/32/64 位元浮點數或布林值,或 2/4/8/16/32/64 位元整數,或具有 32/64 位元浮點元素或每個張量整數量化值或每個軸整數量化值的複數型別張量

chlo.zeta (chlo::ZetaOp)

Hurwitz zeta 函式

語法:

operation ::= `chlo.zeta` $x `,` $q attr-dict `:` type($x) `,` type($q) `->` type(results)

傳回 Zeta(operand, operand) 元素。

\[ \(\zeta(x, q) = \sum_{n=0}^{\infty} (q + n)^{-x}\) \]

特徵:AlwaysSpeculatableImplTraitCompatibleOperandsAndResultType

介面:ConditionallySpeculatableInferShapedTypeOpInterfaceInferTypeOpInterfaceNoMemoryEffect (MemoryEffectOpInterface)

影響:MemoryEffects::Effect{}

運算元:

運算元 說明
x 4/6/8/16/32/64 位元浮點值的張量
q 4/6/8/16/32/64 位元浮點值的張量

成果:

結果 說明
result 4/6/8/16/32/64 位元浮點值的張量

屬性

ComparisonDirectionAttr

要執行的比較作業。

語法:

#chlo.comparison_direction<
  ::mlir::chlo::ComparisonDirection   # value
>

參數:

參數 C++ 型別 說明
::mlir::chlo::ComparisonDirection ComparisonDirection 類型的列舉

ComparisonTypeAttr

要使用的比較類型。

語法:

#chlo.comparison_type<
  ::mlir::chlo::ComparisonType   # value
>

參數:

參數 C++ 型別 說明
::mlir::chlo::ComparisonType ComparisonType 類型的列舉

PrecisionAttr

運算元的 XLA 精確度。具有後端特定意義。

語法:

#chlo.precision<
  ::mlir::chlo::Precision   # value
>

參數:

參數 C++ 型別 說明
::mlir::chlo::Precision Precision 類型的列舉

RaggedDotDimensionNumbersAttr

此屬性會為參差不齊的點建立維度資訊模型。

參數:

參數 C++ 型別 說明
lhsBatchingDimensions ::llvm::ArrayRef<int64_t> 維度
rhsBatchingDimensions ::llvm::ArrayRef<int64_t> 維度
lhsContractingDimensions ::llvm::ArrayRef<int64_t> 維度
rhsContractingDimensions ::llvm::ArrayRef<int64_t> 維度
lhsRaggedDimensions ::llvm::ArrayRef<int64_t> 維度
rhsGroupDimensions ::llvm::ArrayRef<int64_t> 維度

列舉

ComparisonDirection

要執行的比較作業。

案件:

符號 字串
EQ 0 EQ
NE 1 NE
GE 2 GE
GT 3 GT
LE 4 LE
LT 5 LT

ComparisonType

要使用的比較類型。

案件:

符號 字串
NOTYPE 0 NOTYPE
FLOAT 1 FLOAT
TOTALORDER 2 TOTALORDER
已簽署 3 已簽署
UNSIGNED 4 UNSIGNED

精確度

運算元的 XLA 精確度。具有後端特定意義。

案件:

符號 字串
預設 0 預設
1
最高 2 最高