Open behrica opened 5 months ago
Something like this works:
(def t (tech.v3.tensor/new-tensor [4 5]))
(import '[org.tribuo.math.la DenseMatrix])
(def jvm (tech.v3.tensor/->jvm t {:base-storage :java-array :datatype :double}))
(DenseMatrix/createDenseMatrix (into-array jvm))
#object[org.tribuo.math.la.DenseMatrix 0x49d26eba "DenseMatrix(dim1=4,dim2=5,values=\n\trow 0 [ 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000];\n\trow 1 [ 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000];\n\trow 2 [ 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000];\n\trow 3 [ 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000];\n)"]
Maybe there is a faster way, and it would only work for 2D tensors of type double
Either by implementing interface org.tribuo.math.la.Matrix based on a tensor, or creating DenseMarix from a tech.v3.tensor
As we have tribuo interop in here anyway, it might make sense