gotch icon indicating copy to clipboard operation
gotch copied to clipboard

How to convert goslice to libtorch.cTensor fast?

Open ZonghaoWang opened this issue 4 years ago • 7 comments

my performance block by the ts.NewTensorFrom, it costs too much time

ZonghaoWang avatar Apr 23 '21 04:04 ZonghaoWang

@ZonghaoWang

Can you give more detail - code example and how you measure your performance please?

sugarme avatar Apr 23 '21 06:04 sugarme

image

DeepX is an float32 slice, whose length is 2000000. I convert it to ctensor and reshape to 1000 X 2000. The time costs is 130ms

ZonghaoWang avatar Apr 23 '21 06:04 ZonghaoWang

Your time measurement was taken for other steps after ts.TensorFrom. Can you just break down just calculate time for ‘ts.TensorFrom’ only? And how do you judge it is slow? In comparison to which? Thanks.

sugarme avatar Apr 23 '21 07:04 sugarme

hi, image image

ZonghaoWang avatar Apr 23 '21 07:04 ZonghaoWang

Any how slow to compare to Python Pytorch? Or other framework?

sugarme avatar Apr 23 '21 07:04 sugarme

Year, I just like go, and use it to train and serving model. When I train small model, the input data convert between go and c may cost too much time. And I test some method to acc it. like this: image image

ZonghaoWang avatar Apr 23 '21 08:04 ZonghaoWang