class_docstr: Operations related to finding k-largest elements.
  
  Parameters
  ----------
  axis: integer
      Defaults to ``-1``.
      The axis to perform the operation. Must be in range ``[-ndim, ndim)``, where
      ``ndim`` is the dimensionality of input tensor.
  
  idx_dtype: string
      Specify output dtype for indices, defaults to ``int64``, must be integer type.
  
  sorted: bool
      NOTE: NOT IMPLEMENTED YET
      Defaults to ``True``
  
      If True, the result array would be sorted in descending order.
  
  
  Notes
  -----
  - CPU and GPU ops don't produce same output order. This is expected.
  - The output order is not guaranteed. On the CPU, we use
    ``np.partition`` and ``np.argpartition`` that only make sure the
    k-th element is the correct one and that the other
    elements are on the correct side. On the GPU, they
    look sorted, but we do not test the correctness of this behavior.
  - By default, this Op gives two outputs: values and indices. However
    optimizers may remove a certain output if not needed.
  - Computing the gradient requests the computation of the indices in
    forward pass.
  - If the top-k-th value is not unique, we cannot guarantee the
    output indices being deterministically chosen.
  
  See Also
  --------
  topk
  argtopk
  argtopk_and_topk
class_docstr_tok: ["Operations","related","to","finding","k-largest","elements",".","Parameters","--","--","--","--","--","axis",":","integer","Defaults","to","``","-1","``",".","The","axis","to","perform","the","operation",".","Must","be","in","range","``","[","-ndim",",","ndim",")","``",",","where","``","ndim","``","is","the","dimensionality","of","input","tensor",".","idx_dtype",":","string","Specify","output","dtype","for","indices",",","defaults","to","``","int64","``",",","must","be","integer","type",".","sorted",":","bool","NOTE",":","NOT","IMPLEMENTED","YET","Defaults","to","``","True","``","If","True",",","the","result","array","would","be","sorted","in","descending","order",".","Notes","--","--","-","-","CPU","and","GPU","ops","do","n't","produce","same","output","order",".","This","is","expected",".","-","The","output","order","is","not","guaranteed",".","On","the","CPU",",","we","use","``","np.partition","``","and","``","np.argpartition","``","that","only","make","sure","the","k-th","element","is","the","correct","one","and","that","the","other","elements","are","on","the","correct","side",".","On","the","GPU",",","they","look","sorted",",","but","we","do","not","test","the","correctness","of","this","behavior",".","-","By","default",",","this","Op","gives","two","outputs",":","values","and","indices",".","However","optimizers","may","remove","a","certain","output","if","not","needed",".","-","Computing","the","gradient","requests","the","computation","of","the","indices","in","forward","pass",".","-","If","the","top-k-th","value","is","not","unique",",","we","can","not","guarantee","the","output","indices","being","deterministically","chosen",".","See","Also","--","--","--","--","topk","argtopk","argtopk_and_topk"]
code: def __init__(
      self,
      axis=-1,
      sorted=True,
      idx_dtype="int64",
      return_values=True,
      return_indices=True,
  ):
      # numpy always uses int64 as output dtype for arg*() routines
      # however, we add "idx_dtype" param as memory is more precious on gpu
      if not isinstance(axis, int):
          raise TypeError(
              '"axis" parameter must be integer, got "%s"' % type(axis)
          )
      if sorted:
          raise NotImplementedError(
              "The sorted parameter is not yet implemented. Use sorted=False for now."
          )
      if idx_dtype not in theano.tensor.integer_dtypes:
          raise TypeError(
              '"idx_dtype" parameter must be an integer dtype, got "%s"'
              % idx_dtype
          )
  
      if not (return_indices or return_values):
          raise ValueError(
              "Neither return_values nor return_indices is True, this isn't allowed"
          )
  
      self.axis = axis
      self.sorted = sorted
      self.return_values = return_values
      self.return_indices = return_indices
      self.idx_dtype = idx_dtype
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import theano
  from theano.tensor.basic import mul, arange
  from theano.gradient import grad_undefined
  from theano.tensor.subtensor import set_subtensor
label_desc: Use image node_id 1 to create a new TopKOp object from inherited base classes: theano with example: obj = TopKOp(axis, sorted, idx_dtype, return_values, return_indices)