(a, axis=None, dtype=None, keepdims=None)
| 359 | |
| 360 | |
| 361 | def _chunk_sum(a, axis=None, dtype=None, keepdims=None): |
| 362 | # Caution: this is not your conventional array-sum: due |
| 363 | # to the special nature of the preceding blockwise con- |
| 364 | # traction, each chunk is expected to have exactly the |
| 365 | # same shape, with a size of 1 for the dimension given |
| 366 | # by `axis` (the reduction axis). This makes mere ele- |
| 367 | # ment-wise addition of the arrays possible. Besides, |
| 368 | # the output can be merely squeezed to lose the `axis`- |
| 369 | # dimension when keepdims = False |
| 370 | if type(a) is list: |
| 371 | out = reduce(partial(np.add, dtype=dtype), a) |
| 372 | else: |
| 373 | out = a |
| 374 | |
| 375 | if keepdims: |
| 376 | return out |
| 377 | else: |
| 378 | return out.squeeze(axis[0]) |
| 379 | |
| 380 | |
| 381 | def _sum_wo_cat(a, axis=None, dtype=None): |
nothing calls this directly
no test coverage detected
searching dependent graphs…