question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

inconsistent behavior of keepdims for CUB-based reductions

See original GitHub issue

It appears that keepdims does not keep all of the reduction dimensions when CUB is enabled and axis is a tuple containing more than one axis.

  • Conditions (you can just paste the output of python -c 'import cupy; cupy.show_config()')
CuPy Version          :  7.0.0rc1 (build from master branch)
CUDA Root             : /usr/local/cuda
CUDA Build Version    : 10010
CUDA Driver Version   : 10010
CUDA Runtime Version  : 10010

  • Code to reproduce
import cupy
x = cupy.ones((64, 64))

cupy.cuda.cub_enabled=False
out = x.sum(axis=(0, 1), keepdims=True)
print("CUB DISABLED shape={}".format(out.shape))

cupy.cuda.cub_enabled=True
out = x.sum(axis=(0, 1), keepdims=True)
print("CUB ENABLED shape={}".format(out.shape))

gives

CUB DISABLED shape=(1, 1)
CUB ENABLED shape=(1,)

cc @leofang

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
grlee77commented, Nov 27, 2019

Apparently I didn’t think it was a problem

I think the origin of the problem was an oversight on my part in #2517. I enabled reduction over all axes there, but did not ensure that keepdims preserved all of the axes.

1reaction
grlee77commented, Nov 26, 2019

I am working on a fix for this currently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

In numpy.sum() there is parameter called "keepdims". What ...
An example showing keepdims in action when working with higher dimensional ... Let's see how the shape of the array changes as we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found