* garrow_tensor_get_shape: * @tensor: A #GArrowTensor. * @n_dimensions: (out): The number of dimensions. * * Returns: (array length=n_dimensions) (transfer full): * The shape of the tensor. * * It should be freed with g_free() when no longer needed. * * Since: 0.3.0 */
| 286 | * Since: 0.3.0 |
| 287 | */ |
| 288 | gint64 * |
| 289 | garrow_tensor_get_shape(GArrowTensor *tensor, gint *n_dimensions) |
| 290 | { |
| 291 | auto arrow_tensor = garrow_tensor_get_raw(tensor); |
| 292 | auto arrow_shape = arrow_tensor->shape(); |
| 293 | auto n_dimensions_raw = arrow_shape.size(); |
| 294 | auto shape = static_cast<gint64 *>(g_malloc_n(sizeof(gint64), n_dimensions_raw)); |
| 295 | for (gsize i = 0; i < n_dimensions_raw; ++i) { |
| 296 | shape[i] = arrow_shape[i]; |
| 297 | } |
| 298 | *n_dimensions = static_cast<gint>(n_dimensions_raw); |
| 299 | return shape; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * garrow_tensor_get_strides: |
nothing calls this directly
no test coverage detected