BatchImages

class torchaug.ta_tensors.BatchImages(data: Any, *, dtype: dtype | None = None, device: device | str | int | None = None, requires_grad: bool | None = None)[source]

torch.Tensor subclass for batch of images.

Parameters:
  • data – Any data that can be turned into a tensor with torch.as_tensor().

  • dtype – Desired data type. If omitted, will be inferred from data.

  • device – Desired device. If omitted and data is a torch.Tensor, the device is taken from it. Otherwise, the image is constructed on the CPU.

  • requires_grad – Whether autograd should record operations. If omitted and data is a torch.Tensor, the value is taken from it. Otherwise, defaults to False.

classmethod cat(images_batches)[source]

Concatenates the sequence of images batches into a single batch.

Return type:

BatchImages

to_samples()[source]

Get the tensors.

Return type:

list[Image]