Caffe2 - C++ API
A deep learning, cross platform ML framework
cast.h
1 #pragma once
2 
3 #include <caffe2/utils/proto_utils.h>
4 
5 namespace caffe2 {
6 
7 namespace cast {
8 
9 inline TensorProto_DataType GetCastDataType(const ArgumentHelper& helper, std::string arg) {
10  TensorProto_DataType to;
11  if (helper.HasSingleArgumentOfType<string>(arg)) {
12 #ifndef CAFFE2_USE_LITE_PROTO
13  string s = helper.GetSingleArgument<string>(arg, "float");
14  std::transform(s.begin(), s.end(), s.begin(), ::toupper);
15  CAFFE_ENFORCE(TensorProto_DataType_Parse(s, &to), "Unknown 'to' argument: ", s);
16 #else
17  CAFFE_THROW("String cast op not supported");
18 #endif
19  } else {
20  to = static_cast<TensorProto_DataType>(
21  helper.GetSingleArgument<int>(arg, TensorProto_DataType_FLOAT));
22  }
23  return to;
24 }
25 
26 }; // namespace cast
27 
28 }; // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...