A minimal sbt project to use lamp:
libraryDependencies += "io.github.pityka" %% "lamp-data" % "VERSION" // look at the github page for version
lamp-core
depends on cats-effect and aten-scalalamp-data
in addition depends on scribe and ujsonLamp depends on aten-scala is a JNI binding to libtorch. It has has cross compiled artifacts for Mac and Linux. Mac has no GPU support. Your system has to have the libtorch 1.8.0 shared libraries in its linker path.
This will allocate an identity matrix of 32-bit floats in the main memory:
aten.ATen.eye_0(2L,aten.TensorOptions.dtypeFloat)
// res0: aten.Tensor = Tensor at 139981092027168; CPUFloatType
The following will allocate an identity matrix of 32-bit floats in the GPU memory. It will throw an exception if GPU support is not available
aten.ATen.eye_0(2L,aten.TensorOptions.dtypeFloat.cuda)