You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tvm.apache.org by Zacario Li via TVM Discuss <no...@discuss.tvm.ai> on 2019/08/08 02:21:26 UTC

[TVM Discuss] [Development] [Relay][op] How to understand GetValidCountRel?


I'm trying to add my own OP in relay.
Here is an existing function, but I can't understand it. Does anyone give me some hints?(tvm/src/relay/op/vision/nms.cc)


    bool GetValidCountRel(const Array<Type>& types,
                      int num_inputs,
                      const Attrs& attrs,
                      const TypeReporter& reporter) {
      CHECK_EQ(types.size(), 2);
      const auto* data = types[0].as<TensorTypeNode>();
      const auto& dshape = data->shape;
      CHECK_EQ(dshape.size(), 3) << "Input data should be 3-D.";
    
      std::vector<IndexExpr> oshape({data->shape[0]});
      std::vector<Type> fields;
      fields.push_back(TensorTypeNode::make(oshape, Int(32)));
      fields.push_back(TensorTypeNode::make(data->shape, data->dtype));

      // assign output type
      reporter->Assign(types[1], TupleTypeNode::make(Array<Type>(fields)));
      return true;
    }





---
[Visit Topic](https://discuss.tvm.ai/t/relay-op-how-to-understand-getvalidcountrel/3671/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/13a9f9c9ca70932728dcca39acfcfe0947ad408b3b120459eb72e678e439dc42).

Tianqi Chen, UW, Seattle, WA, 98105, United States
http://tracking.discuss.tvm.ai/tracking/unsubscribe?msgid=w7-ShZNc3Fy3_5OGnzS26w2