diff --git a/paddle/operators/top_k_op.cc b/paddle/operators/top_k_op.cc index ac9257259548dc4223efac239d8362f69366850c..16ae925eb5cab1c05f3bc376972cabadc4367d20 100644 --- a/paddle/operators/top_k_op.cc +++ b/paddle/operators/top_k_op.cc @@ -48,20 +48,20 @@ class TopkOpMaker : public framework::OpProtoAndCheckerMaker { public: TopkOpMaker(framework::OpProto *proto, framework::OpAttrChecker *op_checker) : OpProtoAndCheckerMaker(proto, op_checker) { - AddInput("X", "The input of Topk op"); - AddOutput("Out", "The output tensor of Topk op"); - AddOutput("Indices", "The indices of Topk elements of input"); - AddComment( - R"DOC(If the input is a vector (1d tensor), - finds the k largest entries in the vector - and outputs their values and indices as vectors. - Thus values[j] is the j-th largest entry in input, - and its index is indices[j]. + AddInput("X", "(Tensor) The input of Topk op"); + AddOutput("Out", "(Tensor) The output tensor of Topk op"); + AddOutput("Indices", "(Tensor) The indices of Topk elements of input"); + AddComment(R"DOC( +Top K operator - For matrices, computes the top k entries in each row. )DOC"); +If the input is a vector (1d tensor), this operator finds the k largest +entries in the vector and outputs their values and indices as vectors. +Thus values[j] is the j-th largest entry in input, and its index is indices[j]. + +For matrices, this operator computes the top k entries in each row. )DOC"); AddAttr("k", - "Number of top elements to look for along the last " - "dimension (along each row for matrices).") + "(int, default 1) Number of top elements to look for along " + "the last dimension (along each row for matrices).") .SetDefault(1); } }; diff --git a/paddle/operators/uniform_random_op.cc b/paddle/operators/uniform_random_op.cc index 82f9b8fbf1094bde1def83b9a1c464207b7e4669..cd22c561acb6cbd66faf1d3d6ee21779001a2795 100644 --- a/paddle/operators/uniform_random_op.cc +++ b/paddle/operators/uniform_random_op.cc @@ -74,18 +74,30 @@ class UniformRandomOpMaker : public framework::OpProtoAndCheckerMaker { UniformRandomOpMaker(framework::OpProto* proto, framework::OpAttrChecker* op_checker) : framework::OpProtoAndCheckerMaker(proto, op_checker) { - AddOutput("Out", "The output tensor of uniform random op"); - AddComment(R"DOC(Uniform random operator. -Used to initialize tensor with uniform random generator. + AddOutput("Out", "(Tensor) The output tensor of uniform random op"); + AddComment(R"DOC( +Uniform random operator. + +This operator initializes a tensor with random values sampled from a +uniform distribution. + )DOC"); - AddAttr>("shape", "the dimension of random tensor"); - AddAttr("min", "Minimum value of uniform random").SetDefault(-1.0f); - AddAttr("max", "Maximun value of uniform random").SetDefault(1.0f); + AddAttr>("shape", + "(vector) The shape of the output tensor"); + AddAttr("min", + "(float, default -1.0) " + "Minimum value of uniform random") + .SetDefault(-1.0f); + AddAttr("max", + "(float, default 1.0) " + "Maximun value of uniform random") + .SetDefault(1.0f); AddAttr("seed", - "Random seed of uniform random. " - "0 means generate a seed by system") + "(int, default 0) " + "Random seed used for generating samples. " + "0 means use a seed generated by the system.") .SetDefault(0); - AddAttr("data_type", "output tensor data type") + AddAttr("data_type", "(int, default 5(FP32)) Output tensor data type") .SetDefault(framework::DataType::FP32); } };