Layer Operation On GPU

Hello I am a beginner in customize pytorch. I want to create some operation in new layer. However it can not run on GPU. Should I use tensor operation instead of classic operation (all array must convert to tensor and do tensor operation)?, or is there any way in pytorch to run operation in GPU?

Here what I mean by tensor operation:
c = torch.FloatTensor([9]).cuda()
d = c+1
e = c.add(1)
d is conventional way, and e is tensor operation. If I want my layer works on GPU should I using e rather than d ?

-Thank you-

They both have the same effect and work on both CPU and GPU. So use the style that you prefer.

Best regards


1 Like