Skip to content

Make MaxAndArgmax use internally signed axis numbers.#279

Merged
abergeron merged 2 commits intoTheano:masterfrom
obilaniu:reductions
Nov 5, 2016
Merged

Make MaxAndArgmax use internally signed axis numbers.#279
abergeron merged 2 commits intoTheano:masterfrom
obilaniu:reductions

Conversation

@obilaniu
Copy link
Copy Markdown
Contributor

@obilaniu obilaniu commented Nov 4, 2016

This avoids an infinite loop when counting ndX downto 0 with unsigned
integers, as the condition unsigned >= 0 always holds.

This avoids an infinite loop when counting ndX downto 0 with unsigned
integers, as the condition `unsigned >= 0` always holds.
@nouiz
Copy link
Copy Markdown
Member

nouiz commented Nov 4, 2016

jenkins test this
add to whitelist

@nouiz
Copy link
Copy Markdown
Member

nouiz commented Nov 4, 2016

if you can add a test that was failing and now pass, it would be great. I let @abergeron check in more detail the code.

@nouiz
Copy link
Copy Markdown
Member

nouiz commented Nov 4, 2016

jenkins test this

@abergeron
Copy link
Copy Markdown
Member

Nothing was failling before since there was a check on the arguments to prevent it. However it made the reduce-all-axes case return an error.

Comment thread src/gpuarray_buffer_cuda.c Outdated
case 0:
ctx->err = cuLaunchKernel(k->k, 1, 1, 1, 1, 1, 1, shared,
ctx->s, args, NULL);
break;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we want to support 0-dim at this level. This is basically useless.

If you really need it special case it where you do the kernel call.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abergeron I amended the commit, that file is no longer touched. However, I do think it made sense. The pattern is pretty clear:

  • 3-dims is a volume XYZ
  • 2-dims is a matrix XY with Z=1
  • 1-dims is a vector X with Y=Z=1
  • 0-dims is a scalar with X=Y=Z=1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern is clear but running a 1, 1, 1 kernel is almost always a mistake and I don't want to encourage it.

All-dims-reduced will be slow but does work now without errors. Added
testcase to ensure this remains the case.
@abergeron abergeron merged commit 8e5f40f into Theano:master Nov 5, 2016
@obilaniu obilaniu deleted the reductions branch November 5, 2016 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants