mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 18:48:51 +00:00
Refactor the reduce ops in order to introduce argmin/argmax. (#212)
* Refactor the reduce ops in order to introduce argmin/argmax. * Clippy fixes. * Use the newly introduced argmax. * Fix the strided case. * Handle the non-contiguous case.
This commit is contained in:
@ -17,6 +17,20 @@ pub enum ReduceOp {
|
||||
Sum,
|
||||
Min,
|
||||
Max,
|
||||
ArgMin,
|
||||
ArgMax,
|
||||
}
|
||||
|
||||
impl ReduceOp {
|
||||
pub(crate) fn name(&self) -> &'static str {
|
||||
match self {
|
||||
Self::ArgMax => "argmax",
|
||||
Self::ArgMin => "argmin",
|
||||
Self::Min => "min",
|
||||
Self::Max => "max",
|
||||
Self::Sum => "sum",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// These ops return the same type as their input type.
|
||||
|
Reference in New Issue
Block a user