ANeuralNetworksMemory_copy

Function ANeuralNetworksMemory_copy 

Source
pub unsafe extern "C" fn ANeuralNetworksMemory_copy(
    src: *const ANeuralNetworksMemory,
    dst: *const ANeuralNetworksMemory,
) -> c_int
Expand description

Copies data from one memory object to another.

If at most one of the src and dst is created from {@link ANeuralNetworksMemory_createFromDesc}, the src and dst must have the same logical size:

  • If the memory is created from {@link ANeuralNetworksMemory_createFromFd}, or if it is created from {@link ANeuralNetworksMemory_createFromAHardwareBuffer} with format of AHARDWAREBUFFER_FORMAT_BLOB, the logical size equals the size of the memory.
  • If the memory is created from {@link ANeuralNetworksMemory_createFromAHardwareBuffer} with a format other than AHARDWAREBUFFER_FORMAT_BLOB, the logical size equals the size when there is no padding and the data is tightly packed. This function may fail if the AHardwareBuffer cannot be accessed.
  • If the memory is created from {@link ANeuralNetworksMemory_createFromDesc}, the logical size equals the size indicated by the {@link OperandCode} multiplied by the number of elements. This function will fail if the number of elements is unknown.

If both src and dst are created from {@link ANeuralNetworksMemory_createFromDesc}, they must have compatible dimensions. Two dimensions are incompatible if both ranks are fully specified but have different values, or if there is at least one axis that is fully specified in both but has different values. The dst may have unspecified dimensions or rank. In such a case, the dimensions of dst will get updated according to the dimensions of the src.

In both cases, if the src is created from {@link ANeuralNetworksMemory_createFromDesc}, it must have been used as an output in a successful execution, or used as the destination memory in a successful {@link ANeuralNetworksMemory_copy}.

The src and dst may have different data layout, in which case the data copying is performed logically with data layout transformation.

Available since API level 30.

@param src The source memory object. @param dst The destination memory object.

@return ANEURALNETWORKS_NO_ERROR if successful.