Lite算子支持

查看源文件

本文列举MindSpore Lite支持的算子。

操作名
 

CPU
FP16

CPU
FP32

CPU
Int32

CPU
Int8

CPU
UInt8

CPU
Bool

GPU
FP16

GPU
FP32

GPU
Int32

GPU
Int8

NPU
 

TensorRT
 

Ascend
(Atlas 200/300/500推理产品)

支持的TensorFlow Lite算子

支持的Caffe算子

支持的Onnx算子

支持的TensorFlow算子

Abs

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Abs

Abs

Abs

AbsGrad

✅

Activation

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Activation, ReLU, ReLU6, PReLU,
LeakyReLU, Tanh, HardSwish, Logistic

ReLU, ReLU6, Sigmoid, TanH, Elu

Relu, LeakyRelu, PRelu, Elu, Tanh, Sigmoid, HardSigmoid, Softplus

Activation, Elu, Relu, Relu6, Sigmoid, Tanh, Selu, LeakyRelu, Softplus

ActivationGrad

✅

✅

Adam

✅

Adam

Adam

AddFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Add

Add, Int8Add

Add, AddV2

AdderFusion

✅

adder_f

AddGrad

✅

AddN

✅

✅

AddN

Affine

✅

✅

All

✅

✅

All

All

AllGather

✅

✅

ApplyMomentum

✅

✅

ApplyMomentum

ApplyMomentum

Assert

✅

✅

✅

Assert

Assign

✅

✅

Assign

Assign

ArgmaxFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

Argmax

ArgMax

ArgMax

ArgMax

ArgminFusion

✅

✅

✅

✅

✅

✅

✅

Argmin

ArgMin

AvgPoolFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

MeanPooling

Pooling

AveragePool,
GlobalAveragePool,
Int8AveragePool

AvgPool

AvgPoolGrad

✅

✅

BatchNorm

✅

✅

✅

✅

✅

✅

✅

BatchNorm

BatchNormalization

BatchNormGrad

✅

✅

BatchToSpace

✅

✅

✅

✅

✅

BatchToSpace

BatchToSpace

BatchToSpaceND

✅

✅

✅

✅

✅

✅

BatchToSpaceND

BatchToSpaceND

BiasAdd

✅

✅

✅

✅

✅

✅

✅

✅

BiasAdd

BiasAdd

BiasAddGrad

✅

✅

BinaryCrossEntropy

✅

✅

BinaryCrossEntropy

BinaryCrossEntropy

BinaryCrossEntropyGrad

✅

BroadcastTo

✅

✅

✅

✅

BroadcastTo

Expand

BroadcastTo

Call

✅

✅

✅

✅

✅

Cast

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Cast,
QUANTIZE,
DEQUANTIZE

Cast

Cast

Ceil

✅

✅

✅

✅

✅

✅

✅

✅

Ceil

Ceil

Ceil

Clip

✅

✅

Clip

Clip

Clip

Concat

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Concat

Concat

Concat

ConcatV2

ConstantOfShape

✅

✅

✅

ConstantOfShape

Conv2DFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

Conv2D

Convolution

Conv, Int8Conv,
ConvRelu,
Int8ConvRelu

Conv2D

Conv2DBackpropFilterFusion

✅

✅

Conv2DBackpropInputFusion

✅

✅

Conv2dTransposeFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

DeConv2D

Deconvolution

ConvTranspose

Conv2DBackpropInput

Cos

✅

✅

✅

✅

✅

✅

✅

✅

Cos

Cos

Cos

Crop

✅

✅

✅

✅

✅

Crop

CropAndResize

✅

✅

CropAndResize

CumSum

✅

✅

Cumsum

CustomExtractFeatures

✅

ExtractFeatures

CustomNormalize

✅

Normalize

CustomPredict

✅

✅

Predict

DEConv2DGradFilter

✅

DepthToSpace

✅

✅

✅

✅

✅

✅

DepthToSpace

DepthToSpace

DepthToSpace

DetectionPostProcess

✅

✅

✅

Custom

DivFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Div, RealDiv

Div

Div, RealDiv

DivGrad

✅

Dropout

✅

✅

Dropout

Dropout

Dropout

DropoutGrad

✅

✅

DynamicQuant

✅

DynamicQuantizeLinear

Eltwise

✅

✅

✅

✅

✅

✅

✅

✅

✅

Eltwise

Sum, Max[3]

Elu

✅

✅

✅

ELU

Elu,
NonMaxSuppression

NonMaxSuppressionV3

Equal

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Equal

Equal

Equal

EmbeddingLookupFusion

✅

Erf

✅

✅

✅

Erf

Erf

Erf

ExpFusion

✅

✅

✅

✅

Exp

Exp

Exp

Exp

ExpandDims

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

ExpandDims

ExpandDims

Fill

✅

✅

✅

✅

✅

✅

✅

Fill

Fill

Flatten

✅

✅

✅

✅

✅

Flatten

FlattenGrad

✅

✅

Floor

✅

✅

✅

✅

✅

✅

✅

✅

flOOR

Floor

Floor

FloorDiv

✅

✅

✅

✅

✅

✅

FloorDiv

FloorDiv

FloorMod

✅

✅

✅

✅

✅

✅

FloorMod

FloorMod

FullConnection

✅

✅

✅

✅

✅

✅

✅

✅

✅

FullyConnected

InnerProduct

FusedBatchNorm

✅

✅

✅

✅

✅

✅

FusedBatchNorm

FusedBatchNorm,
FusedBatchNormV3

GatherNd

✅

✅

✅

✅

✅

✅

✅

✅

✅

GatherND

GatherNd

Gather

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Gather

Gather

GatherV2

GatherD

✅

✅

✅

✅

✅

GLU

✅

Greater

✅

✅

✅

✅

✅

✅

✅

✅

✅

Greater

Greater

Greater

GreaterEqual

✅

✅

✅

✅

✅

✅

✅

✅

✅

GreaterEqual

GreaterEqual

GroupNormFusion

✅

GRU

✅

✅

HashtableLookup

✅

✅

HashtableLookup

InstanceNorm

✅

✅

✅

InstanceNorm

InstanceNormalization

InvertPermutation

✅

✅

✅

InvertPermutation

IsFinite

✅

✅

IsFinite

IsFinite

L2NormalizeFusion

✅

✅

✅

LayerNormFusion

✅

✅

✅

✅

✅

LayerNormGrad

✅

✅

LeakyReLU

✅

✅

✅

✅

✅

✅

✅

✅

LeakyRelu

LeakyRelu

LeakyRelu

Less

✅

✅

✅

✅

✅

✅

✅

✅

Less

Less

Less

LessEqual

✅

✅

✅

✅

✅

✅

✅

✅

LessEqual

LessEqual

LRN

✅

LocalResponseNorm

Lrn, LRN

Log

✅

✅

✅

✅

✅

✅

✅

Log

Log

Log

Log1p

✅

✅

Log1p

Log1p

LogGrad

✅

✅

LogicalAnd

✅

✅

✅

✅

✅

✅

✅

LogicalAnd

And

LogicalAnd

LogicalNot

✅

✅

✅

✅

✅

✅

✅

✅

LogicalNot

Not

LogicalNot

LogicalOr

✅

✅

✅

✅

✅

✅

LogicalOr

Or

LogicalOr

LogSoftmax

✅

✅

LogSoftmax

LogSoftmax

LshProjection

✅

LshProjection

LSTM

✅

✅

LSTM

LSTMGrad

✅

LSTMGradData

✅

LSTMGradWeight

✅

MatMulFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

BatchMatMul

MatMul,
Gemm

MatMul,
BatchMatMul,
BatchMatMulV2

Maximum

✅

✅

✅

✅

✅

✅

✅

Maximum

Max

Maximum

MaximumGrad

✅

✅

MaxPoolFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

MaxPooling

Pooling

MaxPool,
GlobalMaxPool

MaxPool

MaxPoolGrad

✅

✅

Merge

✅

✅

Merge

Minimum

✅

✅

✅

✅

✅

✅

✅

Minimum

Min

Minimum

MinimumGrad

✅

✅

Mod

✅

✅

✅

Mod

Mod

Mod

MulFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Mul

Mul

Mul

MulGrad

✅

Neg

✅

✅

✅

✅

✅

✅

Neg

Neg

Neg

NegGrad

✅

✅

NLLLoss

✅

✅

NLLLossGrad

✅

NotEqual

✅

✅

✅

✅

✅

✅

✅

✅

NotEqual

NotEqual

NonMaxSupppression

✅

✅

NonMaxSupppression

NonMaxSupppression

NonMaxSupppression

NonZero

✅

✅

NonZero

NonZero

NonZero

OneHot

✅

✅

✅

✅

✅

✅

OneHot

OneHot

OneHot

OnesLike

✅

✅

✅

✅

✅

OnesLike

OnesLike

PadFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

Pad, MirrorPad, PadV2

Pad

MirrorPad, Pad, PadV2

PartialFusion

✅

✅

✅

✅

PowFusion

✅

✅

✅

✅

✅

✅

✅

✅

Pow

Power

Pow[2]

Pow

PowerGrad

✅

PriorBox

✅

✅

✅

✅

PReLUFusion

✅

✅

✅

✅

✅

PRELU

PReLU

PRelu

QuantDTypeCast

✅

✅

✅

✅

RaggedRange

✅

✅

✅

RaggedRange

RandomNormal

✅

✅

RandomNormal

RandomNormal

RandomNormal

RandomStandardNormal

✅

✅

RandomStandardNormal

Range

✅

✅

✅

Range

Range

Range

Rank

✅

✅

Rank

Rank

RealDiv

✅

✅

✅

Reciprocal

✅

✅

✅

✅

Reciprocal

ReduceFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Sum, Mean, ReduceMax, ReduceMin, ReduceProd

Reduction

ReduceMean, ReduceMax, ReduceMin, ReduceProd, ReduceSum, ReduceSumSquare, ReduceL2

Sum, Max, Min, Mean, Prod, All

ReduceScatter

✅

✅

Reshape

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Reshape

Reshape

Reshape,
Flatten

Reshape

Resize

✅

✅

✅

✅

✅

✅

✅

✅

ResizeBilinear,
NearestNeighbor

Interp

Resize, Upsample

ResizeBilinear,
ResizeBicubic,
ResizeNearestNeighbor

ResizeGrad

✅

✅

ReverseV2

✅

✅

reverse

ReverseV2

ReverseSequence

✅

ReverseSequence

ReverseSequence

ROIPooling

✅

✅

Round

✅

✅

✅

✅

✅

✅

✅

✅

Round

Round

Round

Rsqrt

✅

✅

✅

✅

✅

✅

✅

Rsqrt

Rsqrt

RsqrtGrad

✅

✅

Select

✅

✅

Select

Selu

Selu

ScaleFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

Scale

ScatterNd

✅

✅

✅

ScatterNd

ScatterND

ScatterNdUpdate

✅

✅

✅

ScatterNdUpdate

ScatterNdUpdate

SGD

✅

✅

SGD

SGD

SGD

Shape

✅

✅

✅

✅

✅

✅

✅

✅

✅

Shape

Shape

Shape

SigmoidCroosEntropyWithLogits

✅

✅

SigmoidCroosEntropyWithLogitsGrad

✅

✅

Sin

✅

✅

✅

✅

✅

✅

✅

✅

Sin

Sin

Sin

Size

✅

✅

✅

Size

SliceFusion

✅

✅

✅

✅

✅

✅

✅

✅

Slice

Slice

Slice

Slice

SkipGram

✅

SKipGram

SmoothL1Loss

✅

✅

SmoothL1LossGrad

✅

✅

Softmax

✅

✅

✅

✅

✅

✅

✅

✅

✅

Softmax

Softmax

Softmax

Softmax

SoftmaxGrad

✅

Softplus

✅

✅

Softplus

SpaceToBatch

✅

✅

✅

✅

✅

✅

SpaceToBatch

SpaceToBatchND

✅

✅

✅

✅

✅

✅

SpaceToBatchND

SpaceToBatchND

SpaceToDepth

✅

✅

✅

✅

SpaceToDepth

SpaceToDepth

SparseToDense

✅

✅

✅

✅

✅

✅

SpareToDense

SparseSoftmaxCrossEntropyWithLogits

✅

✅

Splice

✅

✅

Splice

Split

✅

✅

✅

✅

✅

✅

✅

✅

Split, SplitV

Split

Split, SplitV

SplitWithOverlap

✅

✅

Sqrt

✅

✅

✅

✅

✅

✅

✅

✅

✅

Sqrt

Sqrt

Sqrt

SqrtGrad

✅

✅

Square

✅

✅

✅

✅

✅

✅

✅

✅

Square

Square

SquaredDifference

✅

✅

✅

✅

SquaredDifference

SquaredDifference

Squeeze

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Squeeze

Squeeze

Squeeze

StridedSlice

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

StridedSlice

Slice,
DynamicSlice

StridedSlice

StridedSliceGrad

✅

✅

Stack

✅

✅

✅

✅

✅

✅

Stack

Pack

SubFusion

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Sub

Sub

Sub

SubGrad

✅

Switch

✅

✅

✅

✅

Switch

SwitchLayer

✅

✅

✅

✅

TensorListFromTensor

✅

✅

✅

TensorListFromTensor

TensorListGetItem

✅

✅

✅

TensorListGetItem

TensorListReserve

✅

✅

✅

TensorListReserve

TensorListSetItem

✅

✅

✅

TensorListSetItem

TensorListStack

✅

✅

✅

TensorListStack

TensorScatterAdd

✅

✅

TensorScatterAdd

TensorScatterAdd

TileFusion

✅

✅

✅

✅

✅

Tile

Tile

Tile

Tile

TopKFusion

✅

✅

✅

✅

✅

TopKV2

TopK

TopKV2

Transpose

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Transpose

Permute

Transpose, Int8Transpose

Transpose

UniformReal

✅

✅

Unique

✅

✅

✅

Unique

UnsortedSegmentSum

✅

✅

✅

UnsortedSegmentSum

Unsqueeze

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

✅

Unsqueeze

Unstack

✅

✅

✅

Unstack

Where

✅

✅

✅

✅

Where

NonZero, Where

Where

ZerosLike

✅

✅

✅

ZerosLike

ZerosLike

转换工具支持的其他算子[4]

Constant,
Atan, Asin, Tan,
Loop, Dropout, If, Identity,
Int8GivenIntTensorFill,
Int8GivenTensorFill,
Int8Quantize,
Int8Dequantize,
LpNormalization

Dropout, Enter,
Exit, If,
LinSpace,
LoopCond,
NextIteration,
StatelessIf,
StatelessWhile,
TensorArrayGatherV3,
TensorArrayReadV3,
TensorArrayScatterV3,
TensorArraySizeV3,
TensorArrayV3,
TensorArrayWriteV3,
While

[1] Clip:仅支持将clip(0, 6)转换为Relu6。

[2] Pow:仅支持指数为单个常数。

[3] Sum与Max:仅支持输入个数为2。

[4] 转换工具支持,但不需要具体实现的算子,一般这类算子在转化工具中被优化而消失,如被融合掉或者使用其他算子代替。