@@ -249,15 +249,6 @@ class OpImplementNode : public Object {
249249 */
250250class OpImplement : public ObjectRef {
251251 public:
252- /* ! \brief default constructor */
253- OpImplement () {}
254- /* ! \brief constructor from node pointer */
255- explicit OpImplement (ObjectPtr<Object> n) : ObjectRef(n) {}
256- /* !
257- * \brief access the internal node container
258- * \return the pointer to the internal node container
259- */
260- inline const OpImplementNode* operator ->() const ;
261252 /* !
262253 * \brief Invoke the operator compute function.
263254 * \param attrs The attribute of the primitive
@@ -278,6 +269,8 @@ class OpImplement : public ObjectRef {
278269 te::Schedule Schedule (const Attrs& attrs,
279270 const Array<te::Tensor>& outs,
280271 const Target& target);
272+
273+ TVM_DEFINE_OBJECT_REF_METHODS (OpImplement, ObjectRef, OpImplementNode);
281274};
282275
283276/* !
@@ -305,18 +298,6 @@ class OpSpecializationNode : public Object {
305298 */
306299class OpSpecialization : public ObjectRef {
307300 public:
308- OpSpecialization () {}
309- explicit OpSpecialization (ObjectPtr<Object> n) : ObjectRef(n) {}
310- /* !
311- * \brief access the internal node container
312- * \return the pointer to the internal node container
313- */
314- inline const OpSpecializationNode* operator ->() const ;
315- /* !
316- * \brief access the internal node container
317- * \return the pointer to the internal node container
318- */
319- inline OpSpecializationNode* operator ->();
320301 /* !
321302 * \brief Add an implementation.
322303 * \param compute Compute function
@@ -325,6 +306,8 @@ class OpSpecialization : public ObjectRef {
325306 */
326307 void AddImplement (FTVMCompute fcompute, FTVMSchedule fschedule,
327308 int plevel);
309+
310+ TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS (OpSpecialization, ObjectRef, OpSpecializationNode);
328311};
329312
330313/* !
@@ -348,49 +331,16 @@ class OpStrategyNode : public Object {
348331 */
349332class OpStrategy : public ObjectRef {
350333 public:
351- /* ! \brief default constructor */
352- OpStrategy () {}
353- /* ! \brief constructor from node pointer */
354- explicit OpStrategy (ObjectPtr<Object> n) : ObjectRef(n) {}
355- /* !
356- * \brief access the internal node container
357- * \return the pointer to the internal node container
358- */
359- inline const OpStrategyNode* operator ->() const ;
360- /* !
361- * \brief access the internal node container
362- * \return the pointer to the internal node container
363- */
364- inline OpStrategyNode* operator ->();
365334 /* !
366335 * \brief Add an implementation.
367336 * \param compute Compute function
368337 * \param schedule Schedule function
369338 * \param plevel Priority level of this implementation.
370339 */
371340 void AddImplement (FTVMCompute fcompute, FTVMSchedule fschedule, int plevel);
372- };
373-
374- // implementations
375- inline const OpImplementNode* OpImplement::operator ->() const {
376- return static_cast <const OpImplementNode*>(get ());
377- }
378341
379- inline const OpSpecializationNode* OpSpecialization::operator ->() const {
380- return static_cast <const OpSpecializationNode*>(get ());
381- }
382-
383- inline OpSpecializationNode* OpSpecialization::operator ->() {
384- return static_cast <OpSpecializationNode*>(get_mutable ());
385- }
386-
387- inline const OpStrategyNode* OpStrategy::operator ->() const {
388- return static_cast <const OpStrategyNode*>(get ());
389- }
390-
391- inline OpStrategyNode* OpStrategy::operator ->() {
392- return static_cast <OpStrategyNode*>(get_mutable ());
393- }
342+ TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS (OpStrategy, ObjectRef, OpStrategyNode);
343+ };
394344
395345} // namespace relay
396346} // namespace tvm
0 commit comments