Skip to content

Latest commit

 

History

History
158 lines (111 loc) · 4.67 KB

File metadata and controls

158 lines (111 loc) · 4.67 KB

ncnn Ops

Expand

Description

Broadcast the input blob following the given shape and the broadcast rule of ncnn.

Parameters

Expand has no parameters.

Inputs

inputs[0]: ncnn.Mat
bottom_blobs[0]; An ncnn.Mat of input data.
inputs[1]: ncnn.Mat
bottom_blobs[1]; An 1-dim ncnn.Mat. A valid shape of ncnn.Mat.

Outputs

outputs[0]: T
top_blob; The blob of ncnn.Mat which expanded by given shape and broadcast rule of ncnn.

Type Constraints

  • ncnn.Mat: Mat(float32)

Gather

Description

Given the data and indice blob, gather entries of the axis dimension of data indexed by indices.

Parameters

Type Parameter Description
int axis Which axis to gather on. Default is 0.

Inputs

inputs[0]: ncnn.Mat
bottom_blobs[0]; An ncnn.Mat of input data.
inputs[1]: ncnn.Mat
bottom_blobs[1]; An 1-dim ncnn.Mat of indices on given axis.

Outputs

outputs[0]: T
top_blob; The blob of ncnn.Mat which gathered by given data and indice blob.

Type Constraints

  • ncnn.Mat: Mat(float32)

Shape

Description

Get the shape of the ncnn blobs.

Parameters

Shape has no parameters.

Inputs

inputs[0]: ncnn.Mat
bottom_blob; An ncnn.Mat of input data.

Outputs

outputs[0]: T
top_blob; 1-D ncnn.Mat of shape (bottom_blob.dims,), `bottom_blob.dims` is the input blob dimensions.

Type Constraints

  • ncnn.Mat: Mat(float32)

TopK

Description

Get the indices and value(optional) of largest or smallest k data among the axis. This op will map to onnx op TopK, ArgMax, and ArgMin.

Parameters

Type Parameter Description
int axis The axis of data which topk calculate on. Default is -1, indicates the last dimension.
int largest The binary value which indicates the TopK operator selects the largest or smallest K values. Default is 1, the TopK selects the largest K values.
int sorted The binary value of whether returning sorted topk value or not. If not, the topk returns topk values in any order. Default is 1, this operator returns sorted topk values.
int keep_dims The binary value of whether keep the reduced dimension or not. Default is 1, each output blob has the same dimension as input blob.

Inputs

inputs[0]: ncnn.Mat
bottom_blob[0]; An ncnn.Mat of input data.
inputs[1] (optional): ncnn.Mat
bottom_blob[1]; An optional ncnn.Mat. A blob of K in TopK. If this blob not exist, K is 1.

Outputs

outputs[0]: T
top_blob[0]; If outputs has only 1 blob, outputs[0] is the indice blob of topk, if outputs has 2 blobs, outputs[0] is the value blob of topk. This blob is ncnn.Mat format with the shape of bottom_blob[0] or reduced shape of bottom_blob[0].
outputs[1]: T
top_blob[1] (optional); If outputs has 2 blobs, outputs[1] is the value blob of topk. This blob is ncnn.Mat format with the shape of bottom_blob[0] or reduced shape of bottom_blob[0].

Type Constraints

  • ncnn.Mat: Mat(float32)