Shortcuts

Struct TensorDataset

Inheritance Relationships

Base Type

Struct Documentation

struct torch::data::datasets::TensorDataset : public torch::data::datasets::Dataset<TensorDataset, TensorExample>

A dataset of tensors.

Stores a single tensor internally, which is then indexed inside get().

Public Functions

TensorDataset(const std::vector<Tensor> &tensors)

Creates a TensorDataset from a vector of tensors.

TensorDataset(torch::Tensor tensor)
TensorExample get(size_t index) override

Returns a single TensorExample.

optional<size_t> size() const override

Returns the number of tensors in the dataset.

Public Members

Tensor tensor

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources