JaggedArray._concatenate_axis1 performs an unexpected dtype change, e.g. two JaggedArrays with np.float32 dtype will result in one JaggedArray with dtype np.float64.
This is caused by the built-in sum(x) function which does behave like reduce(lambda a, b: a + b, x, int(0)) i.e. with an explicit initializer=0 for reduce.
Using numpy.sum is not an option either since it has special dtype determination rules regarding integers.
JaggedArray._concatenate_axis1
performs an unexpected dtype change, e.g. twoJaggedArray
s withnp.float32
dtype will result in oneJaggedArray
with dtypenp.float64
.This is caused by the built-in
sum(x)
function which does behave likereduce(lambda a, b: a + b, x, int(0))
i.e. with an explicitinitializer=0
forreduce
.Using
numpy.sum
is not an option either since it has special dtype determination rules regarding integers.I've also added a corresponding test.