You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/09/18 08:23:17 UTC

[GitHub] [incubator-mxnet] reminisce commented on a change in pull request #16100: Infra for tvm op runtime dispatch

reminisce commented on a change in pull request #16100: Infra for tvm op runtime dispatch
URL: https://github.com/apache/incubator-mxnet/pull/16100#discussion_r325499450
 
 

 ##########
 File path: src/operator/tvmop/op_module.h
 ##########
 @@ -56,6 +57,79 @@ class TVMOpModule {
   std::shared_ptr<Module> module_ptr_;
 };
 
+class OtherOptionEntity {
+ public:
+  explicit OtherOptionEntity(int val): val(val) {}
+  OtherOptionEntity(): val(0) {}
+  inline int get_val() const {
+    return val;
+  }
+ private:
+  int val;
+};
+
+class OtherOptionSpace {
+ public:
+  explicit OtherOptionSpace(const std::vector<int>& entities) {
+    int size = entities.size();
+    for (int i = 0; i < size; ++i) {
+      this->entities.push_back(OtherOptionEntity(entities[i]));
+    }
+  }
+
+  OtherOptionSpace() {}
+
+  inline OtherOptionEntity &operator[] (int idx) {
+    return entities[idx];
+  }
+
+  inline const OtherOptionEntity &operator[] (int idx) const {
+    return entities[idx];
+  }
+
+  inline int size() const {
+    return entities.size();
+  }
+
+ private:
+  std::vector<OtherOptionEntity> entities;
+};
+
+class TVMOpConfig {
+ public:
+  std::string name;
+
+  inline TVMOpConfig& add_space(const std::string& name, const std::vector<int>& val) {
+    int size = val.size();
+    space_map[name] = OtherOptionSpace(val);
+    weight_map[name] = weight_acc;
+    weight_acc *= size;
+    return *this;
+  }
+  inline TVMOpConfig& add_entity(const std::string& name, const int val) {
+    _entity_map[name] = OtherOptionEntity(val);
+    return *this;
+  }
+
+  TVMOpConfig(): weight_acc(1) {}
+
+  inline const OtherOptionSpace& get_space(const std::string& name) const {
+    return space_map.at(name);
+  }
+
+  inline int get_weight(const std::string& name) const {
+    return weight_map.at(name);
+  }
+
+ private:
+  std::map<std::string, OtherOptionEntity> _entity_map;
 
 Review comment:
   coding style: entity_map_. Add `_` suffix for all other data members.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services