Tensors

Creating Tensors

Dataset.create_tensor Creates a new tensor in the dataset.
Dataset.create_group Creates a tensor group.
Dataset.create_tensor_like Copies the source tensor’s meta information and creates a new tensor with it.

Deleting and Renaming Tensors

Dataset.delete_tensor Delete a tensor from the dataset.
Dataset.delete_group Delete a tensor group from the dataset.
Dataset.rename_tensor Renames tensor with name name to new_name
Dataset.rename_group Renames group with name name to new_name

Adding and deleting samples

Tensor.append Appends a single sample to the end of the tensor.
Tensor.extend Extends the end of the tensor by appending multiple elements from a sequence.
Tensor.pop Removes an element at the given index.
Tensor.clear Deletes all samples from the tensor
Tensor.__setitem__ Update samples with new values.

Retrieving samples

Tensor.numpy Computes the contents of the tensor in numpy format.
Tensor.data Returns data in the tensor in a format based on the tensor’s base htype.
Tensor.tobytes Returns the bytes of the tensor.
Tensor.text Return text data.
Tensor.dict Return json data.
Tensor.list Return list data.
Tensor._linked_sample Returns the linked sample at the given index.

Tensor Properties

Tensor.htype Htype of the tensor.
Tensor.base_htype Base htype of the tensor.
Tensor.dtype Dtype of the tensor.
Tensor.shape Get the shape of this tensor.
Tensor.shape_interval Returns a ShapeInterval object that describes this tensor’s shape more accurately.
Tensor.ndim Number of dimensions of the tensor.
Tensor.num_samples Returns the length of the primary axis of the tensor.
Tensor.__len__ Returns the length of the primary axis of the tensor.
Tensor.is_dynamic Will return True if samples in this tensor have shapes that are unequal.
Tensor.is_sequence Whether this tensor is a sequence tensor.
Tensor.is_link Whether this tensor is a link tensor.
Tensor.verify Whether linked data will be verified when samples are added.

Info

Tensor.info Returns the information about the tensor.
Tensor.sample_info Returns info about particular samples in a tensor.

Video features

Tensor.play Play video sample.
Tensor.timestamps Returns timestamps (in seconds) for video sample as numpy array.