MNN Op manual
The specific parameters of Op can be found in *.fbs, and the special case is specified in the corresponding Op below.
[TOC]
Inputs:
input0
: float32(NHWC|NC4HW4)input1
: float32(NHWC|NC4HW4)inputn
: float32(NHWC|NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Concat
Tensorflow op:
- Concat
- ConcatV2
Inputs
input
: float32|int8(NC4HW4)
Outputs:
output
: float32|int8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Convolution
- CuDNNGroupedConvolutionForward
Tensorflow op:
- Conv2D
Inputs:
input
: float32(NC4HW4)
Outpus:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Pooling
Tensorflow op:
- MaxPool
- AvgPool
Inputs:
inputs
: float32(NHWC|NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Relu
Tensorflow op:
- Relu
Inputs:
input
: float32(NC4HW4|NHWC)
Outputs:
outpus
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Softmax
Tensorflow op:
- Softmax
Inputs:
input
: float32(NC4HW4)
Outputs:
outpus
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- PReLU
Tensorflow op:
- PRelu
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- LRN
- CuDNNLRNCrossChannel
Tensorflow op:
- LRN
Inputs:
input
: float32(NC4HW4|NHWC)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op
- Scale
- BatchNorm
- CuDNNBatchNorm
Tensorflow op:
- FusedBatchNorm
Inputs:
input0
: float32(NC4HW4|NHWC)input1
: float32(NC4HW4|NHWC)intputn
: float32(NC4HW4|NHWC)
Outputs:
output
: float32
Backend:
-
- CPU: support Product, Sum, Max
-
- Metal: support Product, Sum, Max
-
- Vulkan: supports Product, Sum
-
- OpenCL: supports Product, Sum, Max
Caffe op:
- Eltwise
Inputs:
input
: float32|int8(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- CuDNNGroupedConvolutionForward
- Convolution(group)
Tensorflow op:
- DepthwiseConv2dNative
Inputs:
input
: float32(NC4HW4)
Outpus:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- ArgMax
Inputs:
input
: float32(NC4HW4|NHWC)shape
: int32(optional)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Flatten
- Reshape
Tensorflow:
- Reshape
Inputs:
- 无
Outputs:
output
: float32|int32|int8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Const
Inputs:
input0
: float32|int32input1
: float32|int32
Outputs:
output
: float32|int32
Backend:
-
- CPU: supports Max, Min, Mul, Add, Sub, ReadDiv, Greater
-
- Metal
-
- Vulkan: supports float32 only; supports Mul, Add, Sub
-
- OpenCL: supports float32 only; supports Mul, Add, Sub, Max
Caffe op:
Tensorflow op:
- Mul
- Sub
- Add
- Maximum
- RealDiv
- Minimum
- Greater
- BiasAdd
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Deconvolution
Tensorflow:
- Conv2DBackpropInput
Inputs:
input0
: float32(NC4HW4)input1
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU: supports Crop Spatial only
-
- Metal
-
- Vulkan: supports Crop Spatial only
-
- OpenCL: supports Crop Spatial only
Limit:
- axis >= 2
Caffe op:
- Crop
Inputs:
input
: float32(NC4HW4)confidence
: float32(NC4HW4)priorbox
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- DetectionOutput
Inputs:
input
: float32(NHWC)dims
: int32
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- ExpandDims
Inputs:
input
: float32(NC4HW4)shape
: int32(optional)
Outputs:
output
: float32
Backend:
-
- CPU: supports Nearstneighbor, bilinear, cubic
-
- Metal
-
- Vulkan: supports bilinear
-
- OpenCL: supports bilinear
Caffe op:
- Interp
Tensorflow:
- ResizeBilinear
- ResizeNearestNeighbor
Inputs:
input0
: float32(NC4HW4)input1
: float32(NC4HW4, optional)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan: support one input only
-
- OpenCL
Caffe op:
- LSTM
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU: unsupport acrossSpatial and channelShared
-
- Metal
-
- Vulkan: unsupport acrossSpatial and channelShared
-
- OpenCL
Caffe op:
- Normalize
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Permute
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- PriorBox
Inputs:
input
: float32(NC4HW4)bounding_box
: float32image_size
: float32
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Inputs:
input
: float32|int32(NHWC)
Outputs:
output
: float32|int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Min
- Max
- Mean
- Sum
- Prod
Inputs:
input
: float32(NC4HW4)roi
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- ROIPooling
Inputs:
input
: float32(NHWC|NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- Sigmoid
Tensorflow op:
- Sigmoid
Inputs:
input
: float32(NHWC|NC4HW4)
Outputs:
output0
: float32output1
: float32outputn
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan: supports NC4HW4 input with axis = 1 only
-
- OpenCL
Caffe op:
- Slice
Tensorflow op:
- Split
Inputs:
input
: float32|int8|int32(NHWC)
Outputs:
output
: float32|int8|int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Squeeze
Inputs:
input
: float32(NHWC|NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- TanH
Tensorflow op:
- TanH
Inputs:
input
: float32(NHWC)multipliers
: int32(NHWC)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Tile
Inputs:
input
: float32(NHWC|NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU: supports Rsqrt, Square, Neg, Exp, Sqrt, Abs, Ceil
-
- Metal: supports Rsqrt, Square, Neg, Exp, Sqrt, Abs, Ceil
-
- Vulkan: supports Rsqrt, Exp, Sqrt, Abs
-
- OpenCL: supports Rsqrt, Exp, Sqrt, Abs
Caffe op:
- UnaryOp
Tensorflow op:
- Rsqrt
- Square
- Exp
- Neg
- Abs
- Ceil
- Sqrt
Inputs:
input0
: float32(NC4HW4)input1
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Caffe op:
- SpatialProduct
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Inputs:
input
: float32|int32(NHWC)
Outputs:
output
: float32|int32
Backend:
-
- CPU: supports Bilinear
-
- Metal
-
- Vulkan: supports Bilinear
-
- OpenCL
Limit:
- DataType only support float and bool
Tensorflow op:
- AsString
Inputs:
input
: float32|int8|int32(NHWC|NC4HW4)
Outputs:
output
: float32|int8|int32
Backend:
-
- CPU
-
- Metal: half->int32, int32->half, uint8->half
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Cast
Inputs:
input
: float32|int32(NHWC)begin
: int32(NHWC)end
: int32(NHWC)strided
: int32(NHWC)
Outputs:
output
: float32|int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- StridedSlice
Inputs:
input
: int8(NHWC)axis
: int32(NHWC)
Outputs:
output
: int8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- ReduceJoin
Inputs:
input0
: int32(NHWC)input1
: float32|int32(NHWC)inputn
: float32|int32(NHWC)
Outputs:
output
: float32|int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Pack
Inputs:
input
: float32(NHWC|NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- ReLU6
Inputs:
boxes
: float32(NHWC)scores
: float32(NHWC)max_output_size
: int32(NHWC)iou_threshold
: float32(NHWC)
Outputs:
output
: int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- NonMaxSuppressionV2
- NonMaxSuppressionV3
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- SpaceToBatchND
Inputs:
input
: float32(NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- BatchToSpaceND
Inputs:
input
: float32|int32|int8
Outputs:
output
: int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Shape
Inputs:
input
: float32(NHWC|NC4HW4)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Selu
Inputs:
intput
: uint8(NC4HW4)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizedConv2D
Inputs:
params
: float32(NHWC)indices
: int32(NHWC)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Gather
Inputs:
params
: float32(NHWC)indices
: int32(NHWC)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- GatherV2
Inputs:
intput
: uint8(NHWC)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizedReshape
Inputs:
intput
: uint8(NHWC)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizedMaxPool
Inputs:
intput
: uint8(NHWC)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizedMaxPool
Inputs:
intput
: float32k
: int
Outputs:
output
: float32indices
: int
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- TopKV2
Inputs:
input
: float32(NHWC)boxes
: float32(NHWC)box_index
: int32(NHWC)crop_size
: int32(NHWC)
Outputs:
output
: int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- CropAndResize
Inputs:
dims
: int32(NHWC)value
: int32(NHWC)
Outputs:
output
: int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Fill
Inputs:
start
: int32|int64|float32|double(NHWC)limit
: int32|int64|float32|double(NHWC)delta
: int32|int64|float32|double(NHWC)
Outputs:
output
: int32|int64|float32|double
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Range
Inputs:
input
: int32(NHWC)
Outputs:
output
: int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Rank
Inputs:
input
: int32|int64|uint8|float32(NHWC)
Outputs:
output
: int32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Size
Inputs:
input
: float32|int32(NHWC)begin
: int32(NHWC)size
: int32(NHWC)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Slice
Inputs:
input
: float32(NHWC)perm
: int32|int64(NHWC)
Outputs:
output
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Transpose
Inputs:
input
: int32(NHWC)
Outputs:
output
: int64
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Where
Inputs:
intput
: uint8(NHWC)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizedSoftmax
Inputs:
intput
: uint8(NC4HW4)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizeDepthwise
Inputs:
input0
: uint8(NHWC)input1
: uint8(NHWC)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizedAdd
Inputs:
intput
: uint8(NHWC)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizedLogistic
Inputs:
intput
: float32(NHWC)
Outputs:
output0
: float32outputN
: float32
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow op:
- Unpack
Inputs:
intput0
: uint8(NHWC)intput1
: uint8(NHWC)intputn
: uint8(NHWC)
Outputs:
output
: uint8
Backend:
-
- CPU
-
- Metal
-
- Vulkan
-
- OpenCL
Tensorflow Lite op:
- QuantizedConcat