* 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 */
| 312 | * Since: 0.3.0 |
| 313 | */ |
| 314 | gint64 * |
| 315 | garrow_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: |
nothing calls this directly
no test coverage detected