tfe_tensor_f64_shape

Function tfe_tensor_f64_shape 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn tfe_tensor_f64_shape( _tensor: *const TfeTensorF64, _out_shape: *mut usize, )
Expand description

Write the shape of the tensor into the caller-provided buffer.

The caller must allocate out_shape with at least tfe_tensor_f64_ndim(tensor) elements.

§Safety

  • tensor must be a valid, non-null tensor pointer.
  • out_shape must point to a buffer with at least ndim usize slots.

§Examples (C)

size_t ndim = tfe_tensor_f64_ndim(t);
size_t *shape = malloc(ndim * sizeof(size_t));
tfe_tensor_f64_shape(t, shape);
// shape now contains the dimensions
free(shape);