scorch icon indicating copy to clipboard operation
scorch copied to clipboard

libtorch C++ jni

Open nazarblch opened this issue 5 years ago • 4 comments

The main changes:

  1. Tensor methods (https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/core/Tensor.h) and torch Functions.h are partially wrapped into Scala API (in src/main/scala/torch_scala/api).
  2. Tensor and Variable classes have been made generic (Tensor[T, TT] and Variable[T, TT]) with templates T corresponded to data type and TT corresponded to device type (example Tensor[Float, CUDA] or Tensor[Int, CPU])
  3. Tensor has implicit wrappers in src/main/scala/torch_scala/api/aten/functions, including MathBackward.scala for backward methods.
  4. Sbt plugin for JNI code generation JniGeneratorPlugin and sbt plugin for cmake so lib building JniBuildPlugin in project directory.
  5. The old scorch code is partially adapted and completion are required.

nazarblch avatar Mar 25 '19 20:03 nazarblch

Thank you very much for your code. I will definitely have a look at it. Keep you posted.

koen-dejonghe avatar Mar 27 '19 09:03 koen-dejonghe

Is it possible to build without GPU support?

koen-dejonghe avatar Apr 04 '19 10:04 koen-dejonghe

Yes, you can build it with https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-latest.zip Pull from the repo first and don't forget to export JAVA_HOME I would propose to discuss this project in skype, what do you think?

Nazar

чт, 4 апр. 2019 г. в 13:21, Koen Dejonghe [email protected]:

Is it possible to build without GPU support?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/botkop/scorch/pull/2#issuecomment-479839922, or mute the thread https://github.com/notifications/unsubscribe-auth/ABslRBWD1Y0CfguviXLxxewwWin_XOxiks5vddISgaJpZM4cI79k .

nazarblch avatar Apr 04 '19 14:04 nazarblch

I created a gitter room. The button is on the readme. We can discuss there.

koen-dejonghe avatar Apr 04 '19 16:04 koen-dejonghe