1 #include "caffe2/operators/map_ops.h" 5 using MapType64To64 = MapTypeTraits<int64_t, int64_t>::MapType;
6 CAFFE_KNOWN_TYPE(MapType64To64);
8 using MapType64To32 = MapTypeTraits<int64_t, int32_t>::MapType;
9 CAFFE_KNOWN_TYPE(MapType64To32);
11 using MapType32To32 = MapTypeTraits<int32_t, int32_t>::MapType;
12 CAFFE_KNOWN_TYPE(MapType32To32);
14 using MapType32To64 = MapTypeTraits<int32_t, int64_t>::MapType;
15 CAFFE_KNOWN_TYPE(MapType32To64);
19 REGISTER_BLOB_SERIALIZER(
20 TypeMeta::Id<MapType64To64>(),
21 MapSerializer<int64_t, int64_t>);
23 REGISTER_BLOB_SERIALIZER(
24 TypeMeta::Id<MapType64To32>(),
25 MapSerializer<int64_t, int32_t>);
27 REGISTER_BLOB_SERIALIZER(
28 TypeMeta::Id<MapType32To32>(),
29 MapSerializer<int32_t, int32_t>);
31 REGISTER_BLOB_SERIALIZER(
32 TypeMeta::Id<MapType32To64>(),
33 MapSerializer<int32_t, int64_t>);
35 REGISTER_BLOB_DESERIALIZER(
36 (std::unordered_map<int64_t, int64_t>),
37 MapDeserializer<int64_t, int64_t>);
39 REGISTER_BLOB_DESERIALIZER(
40 (std::unordered_map<int64_t, int32_t>),
41 MapDeserializer<int64_t, int32_t>);
43 REGISTER_BLOB_DESERIALIZER(
44 (std::unordered_map<int32_t, int32_t>),
45 MapDeserializer<int32_t, int32_t>);
47 REGISTER_BLOB_DESERIALIZER(
48 (std::unordered_map<int32_t, int64_t>),
49 MapDeserializer<int32_t, int64_t>);
51 REGISTER_CPU_OPERATOR(CreateMap, CreateMapOp<CPUContext>);
52 REGISTER_CPU_OPERATOR(KeyValueToMap, KeyValueToMapOp<CPUContext>);
53 REGISTER_CPU_OPERATOR(MapToKeyValue, MapToKeyValueOp<CPUContext>);
55 OPERATOR_SCHEMA(CreateMap)
58 .SetDoc(
"Create an empty map blob")
59 .Arg(
"key_dtype",
"Key's TensorProto::DataType (default INT32)")
60 .Arg(
"value_dtype",
"Value's TensorProto::DataType (default INT32)")
61 .Output(0,
"map blob",
"Blob reference to the map")
62 .ScalarType(TensorProto_DataType_UNDEFINED);
64 OPERATOR_SCHEMA(KeyValueToMap)
67 .SetDoc(
"Convert key and value blob pairs into a map blob")
68 .Input(0,
"key blob",
"Blob reference to the key")
69 .Input(1,
"value blob",
"Blob reference to the value")
70 .Output(0,
"map blob",
"Blob reference to the map");
72 OPERATOR_SCHEMA(MapToKeyValue)
75 .SetDoc(
"Convert a map blob into key and value blob pairs")
76 .Input(0,
"map blob",
"Blob reference to the map")
77 .Output(0,
"key blob",
"Blob reference to the key")
78 .Output(1,
"value blob",
"Blob reference to the value");
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...