1 #ifndef CAFFE2_CORE_TYPES_H_ 2 #define CAFFE2_CORE_TYPES_H_ 8 #include "caffe2/core/common.h" 9 #include "caffe2/core/logging.h" 10 #include <c10/util/typeid.h> 11 #include "caffe2/proto/caffe2_pb.h" 12 #include <c10/util/Half.h> 23 inline StorageOrder StringToStorageOrder(
const string& str) {
24 if (str ==
"NHWC" || str ==
"nhwc") {
25 return StorageOrder::NHWC;
26 }
else if (str ==
"NCHW" || str ==
"nchw") {
27 return StorageOrder::NCHW;
29 LOG(ERROR) <<
"Unknown storage order string: " << str;
30 return StorageOrder::UNKNOWN;
34 inline constexpr
char NameScopeSeparator() {
return '/'; }
37 CAFFE2_API TensorProto::DataType TypeMetaToDataType(
const TypeMeta& meta);
40 CAFFE2_API
const TypeMeta& DataTypeToTypeMeta(
const TensorProto::DataType& dt);
51 static_assert(
sizeof(
unsigned short) == 2,
52 "Short on this platform is not 16 bit.");
56 inline bool fp16_type();
59 inline bool fp16_type<at::Half>() {
64 inline bool fp16_type() {
70 #endif // CAFFE2_CORE_TYPES_H_ A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...