Skip to content

Comments

Index* for new types#461

Merged
soumith merged 7 commits intomasterfrom
indextype
Aug 12, 2016
Merged

Index* for new types#461
soumith merged 7 commits intomasterfrom
indextype

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