LogCumSumExp (#2069)
This commit is contained in:
@@ -1202,6 +1202,28 @@ void init_array(nb::module_& m) {
|
||||
nb::kw_only(),
|
||||
"stream"_a = nb::none(),
|
||||
"See :func:`max`.")
|
||||
.def(
|
||||
"logcumsumexp",
|
||||
[](const mx::array& a,
|
||||
std::optional<int> axis,
|
||||
bool reverse,
|
||||
bool inclusive,
|
||||
mx::StreamOrDevice s) {
|
||||
if (axis) {
|
||||
return mx::logcumsumexp(a, *axis, reverse, inclusive, s);
|
||||
} else {
|
||||
// TODO: Implement that in the C++ API as well. See concatenate
|
||||
// above.
|
||||
return mx::logcumsumexp(
|
||||
mx::reshape(a, {-1}, s), 0, reverse, inclusive, s);
|
||||
}
|
||||
},
|
||||
"axis"_a = nb::none(),
|
||||
nb::kw_only(),
|
||||
"reverse"_a = false,
|
||||
"inclusive"_a = true,
|
||||
"stream"_a = nb::none(),
|
||||
"See :func:`logcumsumexp`.")
|
||||
.def(
|
||||
"logsumexp",
|
||||
[](const mx::array& a,
|
||||
|
||||
Reference in New Issue
Block a user