filtering icon indicating copy to clipboard operation
filtering copied to clipboard

Fix type problem for GPU tensors

Open HuangZiliAndy opened this issue 5 years ago • 6 comments

Fix type problem for GPU tensors

HuangZiliAndy avatar Jan 09 '20 22:01 HuangZiliAndy

This fix is not great because it requires transferring the data to GPU each time it's used. That is slow. Better have the device an arg to the constructor, I think.

On Fri, Jan 10, 2020 at 6:00 AM Zili Huang [email protected] wrote:

Fix type problem for GPU tensors

You can view, comment on, or merge this pull request online at:

https://github.com/danpovey/filtering/pull/3 Commit Summary

  • fix type problem for GPU tensors

File Changes

Patch Links:

  • https://github.com/danpovey/filtering/pull/3.patch
  • https://github.com/danpovey/filtering/pull/3.diff

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danpovey/filtering/pull/3?email_source=notifications&email_token=AAZFLOY5NOZJ3NUR4L3HADLQ46M6HA5CNFSM4KE7CZCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IFF62LQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZFLO4ROW4J7WRPH453MULQ46M6HANCNFSM4KE7CZCA .

danpovey avatar Jan 10 '20 01:01 danpovey

I have a project where I need gpu functionality, so I'll go ahead and merge it into my own fork. Thanks @HuangZiliAndy :)

KentoNishi avatar Jun 18 '21 06:06 KentoNishi

I think it would make more sense (would be more efficient) to add a device class member and optional constructor arg. .type_as() only changes the dtype, not the device, anyway, so it seems it wouldn't solve the stated problem.

danpovey avatar Jun 18 '21 07:06 danpovey

i can go ahead and implement that, unless you want to do it :) i'll be slower to write it than you for sure

KentoNishi avatar Jun 18 '21 07:06 KentoNishi

yes, please do!

On Fri, Jun 18, 2021 at 3:15 PM Kento Nishi @.***> wrote:

i can go ahead and implement that, unless you want to do it :) i'll be slower to write it than you for sure

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danpovey/filtering/pull/3#issuecomment-863815626, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZFLOYRENTXVNSPXLQNYSDTTLXATANCNFSM4KE7CZCA .

danpovey avatar Jun 18 '21 07:06 danpovey

hm, i just found out that torchaudio.transforms.Resample exists. i'll give that a try instead :P

KentoNishi avatar Jun 18 '21 19:06 KentoNishi