vector_dup
Function
vector_dup instruction abstraction.
y = vector_dup(x), where x and y are filled with elements by element.
Prototype
1 | class vector_dup(x, y, fill_shape) |
Parameters
Parameter |
Input/Output |
Data Type |
Description |
|---|---|---|---|
x |
Input |
Tensor variable |
Input x-vector tensor. FP16, FP32, INT16, INT32, UINT16, and UINT32 are supported. |
y |
Output |
Tensor variable |
Output y-vector tensor. FP16, FP32, INT16, INT32, UINT16, and UINT32 are supported. |
fill_shape |
Input |
list |
Shape value to be expanded of the target tensor. |
Constraints
Since the input to this instruction is only a scalar, you need to create a tensor whose shape is [1] and is_inited is True as the simulated scalar input, without increasing performance overhead.
Example
1 2 3 4 | from mskpp import vector_dup, Tensor ub_x = Tensor("UB", "FP16", [1], format="ND", is_inited=True) ub_y = Tensor("UB") out = vector_dup(ub_x, ub_y, [8, 2048])() |
Parent topic: Description of msKPP External APIs