GArrowTensor

GArrowTensor — Tensor class.

Functions

Properties

gpointer tensor Write / Construct Only

Types and Values

struct GArrowTensor

Object Hierarchy

    GObject
    ╰── GArrowTensor

Includes

#include <arrow-glib/arrow-glib.h>

Description

GArrowTensor is a tensor class.

Functions

garrow_tensor_new ()

GArrowTensor *
garrow_tensor_new (GArrowDataType *data_type,
                   GArrowBuffer *data,
                   gint64 *shape,
                   gsize n_dimensions,
                   gint64 *strides,
                   gsize n_strides,
                   gchar **dimention_names,
                   gsize n_dimention_names);

Parameters

data_type

A GArrowDataType that indicates each element type in the tensor.

 

data

A GArrowBuffer that contains tensor data.

 

shape

A list of dimension sizes.

[array length=n_dimensions]

n_dimensions

The number of dimensions.

 

strides

A list of the number of bytes in each dimension.

[array length=n_strides][nullable]

n_strides

The number of strides.

 

dimention_names

A list of dimension names.

[array length=n_dimention_names][nullable]

n_dimention_names

The number of dimension names

 

Returns

The newly created GArrowTensor.

Since 0.3.0


garrow_tensor_get_value_data_type ()

GArrowDataType *
garrow_tensor_get_value_data_type (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The data type of each value in the tensor.

[transfer full]

Since 0.3.0


garrow_tensor_get_value_type ()

GArrowType
garrow_tensor_get_value_type (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The type of each value in the tensor.

Since 0.3.0


garrow_tensor_get_buffer ()

GArrowBuffer *
garrow_tensor_get_buffer (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The data of the tensor.

[transfer full]

Since 0.3.0


garrow_tensor_get_shape ()

gint64 *
garrow_tensor_get_shape (GArrowTensor *tensor,
                         gint *n_dimensions);

Parameters

tensor

A GArrowTensor.

 

n_dimensions

The number of dimensions.

[out]

Returns

The shape of the tensor. It should be freed with g_free() when no longer needed.

[array length=n_dimensions]

Since 0.3.0


garrow_tensor_get_strides ()

gint64 *
garrow_tensor_get_strides (GArrowTensor *tensor,
                           gint *n_strides);

Parameters

tensor

A GArrowTensor.

 

n_strides

The number of strides.

[out]

Returns

The strides of the tensor. It should be freed with g_free() when no longer needed.

[array length=n_strides]

Since 0.3.0


garrow_tensor_get_n_dimensions ()

gint
garrow_tensor_get_n_dimensions (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The number of dimensions of the tensor.

Since 0.3.0


garrow_tensor_get_dimension_name ()

const gchar *
garrow_tensor_get_dimension_name (GArrowTensor *tensor,
                                  gint i);

Parameters

tensor

A GArrowTensor.

 

i

The index of the target dimension.

 

Returns

The i-th dimension name of the tensor.

Since 0.3.0


garrow_tensor_get_size ()

gint64
garrow_tensor_get_size (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The number of value cells in the tensor.

Since 0.3.0


garrow_tensor_is_mutable ()

gboolean
garrow_tensor_is_mutable (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

TRUE if the tensor is mutable, FALSE otherwise.

Since 0.3.0


garrow_tensor_is_contiguous ()

gboolean
garrow_tensor_is_contiguous (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

TRUE if the tensor is contiguous, FALSE otherwise.

Since 0.3.0


garrow_tensor_is_row_major ()

gboolean
garrow_tensor_is_row_major (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

TRUE if the tensor is row major a.k.a. C order, FALSE otherwise.

Since 0.3.0


garrow_tensor_is_column_major ()

gboolean
garrow_tensor_is_column_major (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

TRUE if the tensor is column major a.k.a. Fortran order, FALSE otherwise.

Since 0.3.0

Types and Values

struct GArrowTensor

struct GArrowTensor;

It wraps arrow::Tensor.

Property Details

The “tensor” property

  “tensor”                   gpointer

The raw std::shared<arrow::Tensor> *.

Flags: Write / Construct Only