bioimage-io / JDLL

The Java library to run Deep Learning models
https://github.com/bioimage-io/JDLL/wiki
Apache License 2.0
27 stars 6 forks source link

Make output tensors accept pre-allocated data #10

Closed tischi closed 1 year ago

tischi commented 1 year ago

Make it possible to build the output Tensor with a pre-allocated RandomAccessibleInteral

carlosuc3m commented 1 year ago

Hello, I am doing the final changes to finally publish the first version of the library.

The change that allows modifying the backend data of the tensors has already been implemented (commit https://github.com/bioimage-io/model-runner-java/commit/fb5ccf7e237dfc9f50c586ba569ae2d521f3bc98).

The method tensor.setData(randomAccessibleInterval<T>) allows modifying any Tensor with the wanted ImgLib2 Img.

The new method Tensor.buildEmptyTensorAndAllocateMemory(...) creates a tensor that allocates the memory for an image of the wanted shape and datatype as suggested in the hackaton.

The old method Tensor.buildEmptyTensor(...) does the same as always, creating an object that can contain an ImgLib2 Image as hte backend but without allocating memory.

In addition, the interface method run(...) no longer returns anything, but it modifies the list of output tensors provided, as also suggeste during the Heidelberg hackaton.

What do you think? @tischi @dasv74 @ivan-ea @tinevez

Also suggestions for improving the names are accepted XD

tischi commented 1 year ago

@carlosuc3m I would propose you just go ahead with what you have. During the upcoming hackathon we will have ample time to work on this!