[][src]Function xaynet::sdk::api::new_model

#[no_mangle]pub unsafe extern "C" fn new_model(
    client: *mut FFIClient,
    dtype: c_uint,
    len: c_ulonglong
) -> PrimitiveModel

Gets a mutable slice PrimitiveModel to a zero-initialized model of given primitive data type dtype and length len.

The new model gets cached, which overwrites any existing cached model. The cache and slice are valid as described in step 4 of the workflow. The cached model can be modified in place, for example for training.

The following data types dtype are currently supported:

Errors

Ignores null pointer clients and returns a PrimitiveModel with null pointer, length zero and void data type immediately.

Returns a PrimitiveModel with null pointer, length zero and void data type if the model is not representable in memory due to the given length len and data type dtype.

Safety

The method dereferences from the raw pointer arguments. Therefore, the behavior of the method is undefined if the arguments don't point to valid objects.