@@ -49,7 +49,8 @@ using OptNameList = c10::optional<std::vector<std::string>>;
4949 _ (FunctionType) \
5050 _ (ClassType) \
5151 _ (CapsuleType) \
52- _ (InterfaceType)
52+ _ (InterfaceType) \
53+ _ (QSchemeType)
5354
5455enum class TypeKind {
5556#define DEFINE_TYPE (T ) T,
@@ -1090,6 +1091,28 @@ struct CAFFE2_API GeneratorType : public Type {
10901091 GeneratorType () : Type(TypeKind::GeneratorType) {}
10911092};
10921093
1094+ struct QSchemeType ;
1095+ using QSchemeTypePtr = std::shared_ptr<QSchemeType>;
1096+ // This type represents a QScheme
1097+ struct CAFFE2_API QSchemeType : public Type {
1098+ static QSchemeTypePtr create () {
1099+ return QSchemeTypePtr (
1100+ new QSchemeType ()); // NOLINT(modernize-make-shared)
1101+ }
1102+ bool operator ==(const Type& rhs) const override {
1103+ return rhs.kind () == kind ();
1104+ }
1105+ std::string str () const override {
1106+ return " QScheme" ;
1107+ }
1108+ static const TypeKind Kind = TypeKind::QSchemeType;
1109+ // global singleton
1110+ static QSchemeTypePtr get ();
1111+
1112+ private:
1113+ QSchemeType () : Type(TypeKind::QSchemeType) {}
1114+ };
1115+
10931116struct DeviceObjType ;
10941117using DeviceObjTypePtr = std::shared_ptr<DeviceObjType>;
10951118// This type represents a Generator
@@ -1261,6 +1284,12 @@ struct getTypePtr_<at::Scalar> final {
12611284 }
12621285};
12631286template <>
1287+ struct getTypePtr_ <c10::QScheme> final {
1288+ static TypePtr call () {
1289+ return QSchemeType::get ();
1290+ }
1291+ };
1292+ template <>
12641293struct getTypePtr_ <at::Generator*> final {
12651294 static TypePtr call () {
12661295 return OptionalType::create (GeneratorType::get ());
@@ -1392,8 +1421,8 @@ struct CAFFE2_API ClassType : public NamedType {
13921421 }
13931422
13941423 std::string str () const override {
1395- return python_str ();
1396- }
1424+ return python_str ();
1425+ }
13971426
13981427 std::string python_str () const override {
13991428 const auto & n = name ().value ();
0 commit comments