Skip to main content

tract_tensor_convert_to

Function tract_tensor_convert_to 

Source
pub unsafe extern "C" fn tract_tensor_convert_to(
    input: *const TractTensor,
    datum_type: DatumType,
    output: *mut *mut TractTensor,
) -> TRACT_RESULT
Expand description

Convert a tensor to a new datum type.

This function will perform a cheap shallow clone if the destination type is the same as the current type, otherwise it returns a newly allocated Tensor instead.

In both cases, the returned tensor must be destroyed by tract_tensor_destroy. The input tensor is not consumed, it still need to be destroyed.