tfe_tensor_f64_from_data

Function tfe_tensor_f64_from_data 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn tfe_tensor_f64_from_data( data: *const f64, len: usize, shape: *const usize, ndim: usize, status: *mut tfe_status_t, ) -> *mut TfeTensorF64
Expand description

Create a tensor from caller-provided data (copy semantics).

The data is copied into Rust-owned storage. The caller retains ownership of the data pointer and may free it after this call. The internal memory layout is implementation-defined.

For zero-copy tensor exchange with specific memory layouts, use crate::tfe_tensor_f64_from_dlpack instead.

§Safety

  • data must point to at least len valid f64 values.
  • shape must point to at least ndim valid usize values.
  • status must be a valid, non-null pointer.

§Examples (C)

double data[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
size_t shape[] = {2, 3};
tfe_status_t status;
tfe_tensor_f64 *t = tfe_tensor_f64_from_data(data, 6, shape, 2, &status);
assert(status == TFE_SUCCESS);
tfe_tensor_f64_release(t);