I'm not sure if this was a design decision or a bug, but when you run the sum function with no axis argument, and keep_dims:true, the results are not what I would expect given the way keep_dims works in other cases, as well as given how the keepdims argument in numpy's sum function works.
# #require "owl, owl-top";;
# module A = Owl.Dense.Ndarray.D;;
# let a = A.of_arrays [| [| 1.; 2.; 3. |];
[| 4.; 5.; 6. |] |];;
val a : A.arr =
C0 C1 C2
R0 1 2 3
R1 4 5 6
# A.sum ~keep_dims:true a;;
- : A.arr =
C0
R 21
# A.sum ~keep_dims:true a |> A.shape;;
- : int array = [|1|]
Given the way the keep_dims:true arg works when providing dimensions, (and the way numpy) works, I would expect this result:
I'm not sure if this was a design decision or a bug, but when you run the
sum
function with noaxis
argument, andkeep_dims:true
, the results are not what I would expect given the waykeep_dims
works in other cases, as well as given how thekeepdims
argument in numpy's sum function works.Given the way the
keep_dims:true
arg works when providing dimensions, (and the way numpy) works, I would expect this result:Here's a summary of the function's current behavior
This makes sense except for the case I showed above (the row with the star in this little table).
And here is the whole utop session if you want to view it:
sum.md