24 #ifndef TVM_RELAX_ATTRS_SORTING_H_
25 #define TVM_RELAX_ATTRS_SORTING_H_
39 namespace refl = tvm::ffi::reflection;
40 refl::ObjectDef<SortAttrs>()
42 "Axis along which the sort is computed."
43 "The default the last axis is used.",
44 refl::DefaultValue(-1))
46 "Whether to sort in descending order."
47 "If it is not specified, it defaults to the ascending order.",
48 refl::DefaultValue(
false));
57 ffi::Optional<DLDataType>
dtype;
60 namespace refl = tvm::ffi::reflection;
61 refl::ObjectDef<ArgsortAttrs>()
63 "Axis along which the argsort is computed."
64 "The default the last axis is used.",
65 refl::DefaultValue(-1))
67 "Whether to argsort in descending order."
68 "If it is not specified, it defaults to the ascending order.",
69 refl::DefaultValue(
false))
81 ffi::Optional<DLDataType>
dtype;
84 namespace refl = tvm::ffi::reflection;
85 refl::ObjectDef<TopKAttrs>()
86 .def_ro(
"k", &
TopKAttrs::k,
"Number of top elements to select")
87 .def_ro(
"axis", &
TopKAttrs::axis,
"Axis along which to sort the input tensor.",
88 refl::DefaultValue(-1))
90 "The return type [both, values, indices]."
91 "both - return both top k data and indices."
92 "values - return top k data only."
93 "indices - return top k indices only.",
94 refl::DefaultValue(
"both"))
96 "Whether to return largest or smallest elements."
97 "By default, return the largest k elements.",
98 refl::DefaultValue(
true))
Base class of all attribute class.
Definition: attrs.h:49
Defines a remapping of buffer indices.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:40
Attributes used in argsort operator.
Definition: sorting.h:54
ffi::Optional< DLDataType > dtype
Definition: sorting.h:57
static void RegisterReflection()
Definition: sorting.h:59
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ArgsortAttrs", ArgsortAttrs, AttrsNode)
int axis
Definition: sorting.h:55
bool descending
Definition: sorting.h:56
Attributes used in sort operator.
Definition: sorting.h:34
static void RegisterReflection()
Definition: sorting.h:38
bool descending
Definition: sorting.h:36
int axis
Definition: sorting.h:35
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SortAttrs", SortAttrs, AttrsNode)
Attributes used in topk operator.
Definition: sorting.h:76
int k
Definition: sorting.h:77
ffi::Optional< DLDataType > dtype
Definition: sorting.h:81
ffi::String ret_type
Definition: sorting.h:80
int axis
Definition: sorting.h:78
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.TopKAttrs", TopKAttrs, AttrsNode)
static void RegisterReflection()
Definition: sorting.h:83
bool largest
Definition: sorting.h:79