:github_url: https://github.com/pytorch/pytorch .. _program_listing_file_torch_csrc_api_include_torch_data_datasets_mnist.h: Program Listing for File mnist.h ================================ |exhale_lsh| :ref:`Return to documentation for file ` (``torch/csrc/api/include/torch/data/datasets/mnist.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include #include #include #include #include namespace torch::data::datasets { class TORCH_API MNIST : public Dataset { public: enum class Mode { kTrain, kTest }; explicit MNIST(const std::string& root, Mode mode = Mode::kTrain); Example<> get(size_t index) override; std::optional size() const override; // NOLINTNEXTLINE(bugprone-exception-escape) bool is_train() const noexcept; const Tensor& images() const; const Tensor& targets() const; private: Tensor images_, targets_; }; } // namespace torch::data::datasets