Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index* for new types #461

Merged
merged 7 commits into from
Aug 12, 2016
Merged

Index* for new types #461

merged 7 commits into from
Aug 12, 2016

Conversation

soumith
Copy link
Member

@soumith soumith commented Aug 11, 2016

This makes the index* methods to use CudaLongTensor for indices.
Adds index* for all CUDA types (except indexAdd because need to implement atomicAdd for non float / int types)

Also changes the sort and topK API accordingly (but doesn't add new types in them yet)

Checklist before merging:

  • check and issue fixes to nn / cunn
  • check rnn
  • check dpnn
  • check inn
  • check cunnx (fails but code is half fixed and half isn't and mess. experimental, so ignore)
  • check that densecap works
  • fix half tests

@soumith
Copy link
Member Author

soumith commented Aug 11, 2016

cc: @wickedfoo


for (long i = threadIdx.x; i < sliceSize; i += blockDim.x) {
// Torch indices are 1-based (hence the +1)
base[i * sliceStride] = (float) i + 1.0f;
base[i * sliceStride] = (long) i + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove the (long), it's already long

@wickedfoo
Copy link
Contributor

I think it looks good to me, besides the topk issues (it won't work for some tensors with more than 2^31 - 1 elements).

should add an assertion to topk that you aren't calling it on a tensor where the slice size that you are top-k-ing is > 2^31 - 1 elements.

(also sorry, github notifications have been going to my spam gmail for the past couple of months, hopefully i'll get them now)

@soumith
Copy link
Member Author

soumith commented Aug 12, 2016

fixes #463

@soumith
Copy link
Member Author

soumith commented Aug 12, 2016

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.

2 participants