25#include "neml2/misc/parser_utils.h"
54std::vector<std::string>
57 std::vector<std::string>
tokens;
62 while (
last_pos != std::string::npos)
79 if (begin == std::string::npos)
82 return str.substr(begin, end - begin + 1);
108 throw ParserException(
"Failed to parse boolean value. Only 'true' and 'false' are recognized.");
125 " as a shape, but a shape must start with '(' and end with ')'");
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
The accessor containing all the information needed to access an item in a LabeledAxis.
Definition LabeledAxisAccessor.h:44
Definition parser_utils.h:35
virtual const char * what() const noexcept
Definition parser_utils.cxx:31
std::string trim(const std::string &str, const std::string &white_space)
Definition parser_utils.cxx:76
bool parse< bool >(const std::string &raw_str)
Definition parser_utils.cxx:100
std::stringstream & operator>>(std::stringstream &in, torch::Tensor &)
This is a dummy to prevent compilers whining about not know how to >> torch::Tensor.
Definition parser_utils.cxx:39
std::string demangle(const char *name)
Definition parser_utils.cxx:46
VariableName parse< VariableName >(const std::string &raw_str)
Definition parser_utils.cxx:113
std::vector< std::string > split(const std::string &str, const std::string &delims)
Definition parser_utils.cxx:55
bool start_with(std::string_view str, std::string_view prefix)
Definition parser_utils.cxx:86
bool end_with(std::string_view str, std::string_view suffix)
Definition parser_utils.cxx:92
TorchShape parse< TorchShape >(const std::string &raw_str)
Definition parser_utils.cxx:121
Definition CrossRef.cxx:32
std::vector< TorchSize > TorchShape
Definition types.h:36
LabeledAxisAccessor VariableName
Definition Variable.h:35