Struct TensorDataset¶
Defined in File tensor.h
Page Contents
Inheritance Relationships¶
Base Type¶
public torch::data::datasets::Dataset< TensorDataset, TensorExample >
(Template Class Dataset)
Struct Documentation¶
-
struct 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
-
inline explicit TensorDataset(const std::vector<Tensor> &tensors)¶
Creates a
TensorDataset
from a vector of tensors.
-
inline explicit TensorDataset(torch::Tensor tensor)¶
-
inline virtual TensorExample get(size_t index) override¶
Returns a single
TensorExample
.
-
inline virtual std::optional<size_t> size() const override¶
Returns the number of tensors in the dataset.
Public Members
-
Tensor tensor¶
-
inline explicit TensorDataset(const std::vector<Tensor> &tensors)¶