Caffe2 - C++ API
A deep learning, cross platform ML framework
tuple_parser.h
1 #pragma once
2 
3 #include <torch/csrc/python_headers.h>
4 #include <memory>
5 #include <vector>
6 #include <ATen/ATen.h>
7 
8 namespace torch {
9 
10 struct TupleParser {
11  TupleParser(PyObject* args, int num_args=-1);
12 
13  void parse(bool& x, const std::string& param_name);
14  void parse(int& x, const std::string& param_name);
15  void parse(double& x, const std::string& param_name);
16  void parse(std::vector<int>& x, const std::string& param_name);
17  void parse(std::string& x, const std::string& param_name);
18 
19 protected:
20  std::runtime_error invalid_type(const std::string& expected, const std::string& param_name);
21  PyObject* next_arg();
22 
23 private:
24  PyObject* args;
25  int idx;
26 };
27 
28 } // namespace torch
Definition: jit_type.h:17