[][src]Function onednn_sys::dnnl_memory_set_data_handle_v2

pub unsafe extern "C" fn dnnl_memory_set_data_handle_v2(
    memory: dnnl_memory_t,
    handle: *mut c_void,
    stream: dnnl_stream_t
) -> dnnl_status_t

Sets the underlying memory buffer.

This function may write zero values to the memory specified by the @p handle if the memory object has a zero padding area. This may be time consuming and happens each time this function is called. The operation is always blocking and the stream parameter is a hint.

@note The zero padding is required by memory objects created with blocked memory format tags like #dnnl_aBcd8b when any of the dimensions is not a multiple of the corresponding block size. For "plain" formats like #dnnl_nchw or #dnnl_nhwc zero padding area needs to be set up explicitly when creating the corresponding memory descriptors. See @ref dev_guide_understanding_memory_formats for more details.

@note Even when the memory object is used to hold values that stay constant during the execution of the program (pre-packed weights during inference, for example), the function will still write zeroes to the padding area if it exists. Hence, the @p handle parameter cannot and does not have a const qualifier.

@param memory Memory object. @param handle Data handle. For the CPU engine, the data handle is a pointer to the actual data. For OpenCL it is a cl_mem. @param stream Stream to use to execute padding in. @returns #dnnl_success on success and a status describing the error otherwise.