pub trait TopKLastDimOp {
// Required methods
fn topk(&self, topk: usize) -> Result<TopKOutput>;
fn topk_unsorted(&self, topk: usize) -> Result<TopKOutput>;
}Required Methods§
Sourcefn topk(&self, topk: usize) -> Result<TopKOutput>
fn topk(&self, topk: usize) -> Result<TopKOutput>
Topk in the last dim. values retains a gradient but indices has none w.r.t self.
This expects a contiguous tensor.
Note: this implements torch.topk with sorted=True.
Sourcefn topk_unsorted(&self, topk: usize) -> Result<TopKOutput>
fn topk_unsorted(&self, topk: usize) -> Result<TopKOutput>
Topk in the last dim. values retains a gradient but indices has none w.r.t self.
This expects a contiguous tensor.
Note: this implements torch.topk with sorted=False.