Converts the value of a tensor to a specified type. Conversions between float32, float16, int8, int32, uint8, int16, uint16, uint32, int64, uint64, double64, and Boolean types are supported. Asynchronous calling is supported.
It is supported by the Atlas inference product and
For the
The following conditions must be met:
1 | APP_ERROR ConvertTo(const Tensor &src, Tensor &dst, const MxBase::TensorDType &dataType, AscendStream& stream = AscendStream::DefaultStream()); |
Parameter |
Input/Output |
Description |
|---|---|---|
src |
Input |
Tensor class, input tensor.
|
dst |
Output |
Tensor class, output tensor. An empty tensor can be passed. If dst is not an empty tensor, call Tensor.Malloc() to allocate memory in advance. |
dataType |
Input |
TensorDType class. It specifies the conversion type, which must be the same as the TensorDType property of dst. |
stream |
Input |
AscendStream type. The default value is AscendStream::DefaultStream(). When the parameter value is the default value, the API calling is a synchronous operation. In other cases, the API calling is an asynchronous operation. |
Data Structure |
Description |
|---|---|
APP_ERROR |
For details about the returned error codes, see APP_ERROR Description. |