switchCHWAndHWC

fun switchCHWAndHWC(source: Tensor, result: Tensor)

Switch tensor content between a CHW and HWC format. A tensor of CHW format means it is a multi-dimensional tensor of 1 channel, 3 dimensions: CxHxW. A tensor of HWC format means it is a multi-dimensional tensor of C channels, 2 dimensions: HxW.

Parameters

source

the tensor whose format to be switched. It must either be of CHW format, or HWC format.

result

the required result to store the switch result. If source is of CHW format, it must be of HWC format. If source is of HWC format, it must be of CHW format. The data type must be the same as that of source.

Throws

If the usage is not allowed by the SpatialML run-time Framework, or if the framework encounter internal error and cannot perform the requested behavior.