MCPcopy Create free account
hub / github.com/apache/arrow / garrow_tensor_get_strides

Function garrow_tensor_get_strides

c_glib/arrow-glib/tensor.cpp:314–326  ·  view source on GitHub ↗

* garrow_tensor_get_strides: * @tensor: A #GArrowTensor. * @n_strides: (out): The number of strides. * * Returns: (array length=n_strides) (transfer full): * The strides of the tensor. * * It should be freed with g_free() when no longer needed. * * Since: 0.3.0 */

Source from the content-addressed store, hash-verified

312 * Since: 0.3.0
313 */
314gint64 *
315garrow_tensor_get_strides(GArrowTensor *tensor, gint *n_strides)
316{
317 auto arrow_tensor = garrow_tensor_get_raw(tensor);
318 auto arrow_strides = arrow_tensor->strides();
319 auto n_strides_raw = arrow_strides.size();
320 auto strides = static_cast<gint64 *>(g_malloc_n(sizeof(gint64), n_strides_raw));
321 for (gsize i = 0; i < n_strides_raw; ++i) {
322 strides[i] = arrow_strides[i];
323 }
324 *n_strides = static_cast<gint>(n_strides_raw);
325 return strides;
326}
327
328/**
329 * garrow_tensor_get_n_dimensions:

Callers

nothing calls this directly

Calls 3

garrow_tensor_get_rawFunction · 0.85
stridesMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected