def extract(cls, node): sort = 'value' if node.pb.attr['sorted'] else 'none' TopK.update_node_stat(node, { 'mode': 'max', 'axis': -1, 'sort': sort, 'k': node.pb.attr['k'].i }) return cls.enabled
def extract(cls, node): sort = 'value' if node.pb.attr['sorted'] else 'none' TopK.update_node_stat( node, { 'mode': 'max', 'axis': -1, 'sort': sort, 'index_element_type': np.int32 }) return cls.enabled
def extract(cls, node): """ TopK-1 (k as attribute, required) TopK-10 (k as input, no sorting manipulations) TopK-11 (k as input, sorting manipulations through `sorted` and `largest` attrs) """ attrs = {'axis': onnx_attr(node, 'axis', 'i', default=-1)} if onnx_node_has_attr(node, 'k'): attrs['k'] = onnx_attr(node, 'k', 'i') attrs['sort'] = 'value' if onnx_attr(node, 'sorted', 'i', default=1) else 'none' attrs['mode'] = 'max' if onnx_attr(node, 'largest', 'i', default=1) else 'min' TopK.update_node_stat(node, attrs) return cls.enabled
def extract(node): axis = onnx_attr(node, 'axis', 'i', default=-1) TopK.update_node_stat(node, {'axis': axis, 'sort': 'value'}) return __class__.enabled
def extract(node): sort = 'value' if node.pb.attr['sorted'] else 'none' TopK.update_node_stat(node, {'mode': 'max', 'axis': -1, 'sort': sort}) return __class__.enabled