From d123975aa52b7fde58642f9e9154c1f910c66396 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Tue, 1 Oct 2024 18:40:00 +0200 Subject: [PATCH] improve javadoc --- .../tensorflow/v2/api020/JavaWorker.java | 8 ++- .../v2/api020/tensor/ImgLib2Builder.java | 35 ------------- .../v2/api020/tensor/TensorBuilder.java | 51 +------------------ 3 files changed, 8 insertions(+), 86 deletions(-) diff --git a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/JavaWorker.java b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/JavaWorker.java index 8c5c3a0..738ef07 100644 --- a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/JavaWorker.java +++ b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/JavaWorker.java @@ -21,7 +21,13 @@ public class JavaWorker { private final Tensorflow2Interface ti; private boolean cancelRequested = false; - + + /** + * Method in the child process that is in charge of keeping the process open and calling the model load, + * model inference and model closing + * @param args + * args of the parent process + */ public static void main(String[] args) { try(Scanner scanner = new Scanner(System.in)){ diff --git a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/tensor/ImgLib2Builder.java b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/tensor/ImgLib2Builder.java index 11e6148..9146f02 100644 --- a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/tensor/ImgLib2Builder.java +++ b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/tensor/ImgLib2Builder.java @@ -87,13 +87,6 @@ public static > RandomAccessibleInterval build(Tensor buildFromTensorUByte(Tensor tensor) { long[] arrayShape = tensor.shape().asArray(); @@ -110,13 +103,6 @@ private static RandomAccessibleInterval buildFromTensorUByte(T return Utils.transpose(rai); } - /** - * Builds a {@link RandomAccessibleInterval} from a unsigned int32-typed {@link TInt32} tensor. - * - * @param tensor - * The {@link TInt32} tensor data is read from. - * @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link IntType}. - */ private static RandomAccessibleInterval buildFromTensorInt(Tensor tensor) { long[] arrayShape = tensor.shape().asArray(); @@ -133,13 +119,6 @@ private static RandomAccessibleInterval buildFromTensorInt(Tensor buildFromTensorFloat(Tensor tensor) { long[] arrayShape = tensor.shape().asArray(); @@ -156,13 +135,6 @@ private static RandomAccessibleInterval buildFromTensorFloat(Tensor buildFromTensorDouble(Tensor tensor) { long[] arrayShape = tensor.shape().asArray(); @@ -179,13 +151,6 @@ private static RandomAccessibleInterval buildFromTensorDouble(Tensor return Utils.transpose(rai); } - /** - * Builds a {@link RandomAccessibleInterval} from a unsigned int64-typed {@link TInt64} tensor. - * - * @param tensor - * The {@link TInt64} tensor data is read from. - * @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link LongType}. - */ private static RandomAccessibleInterval buildFromTensorLong(Tensor tensor) { long[] arrayShape = tensor.shape().asArray(); diff --git a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/tensor/TensorBuilder.java b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/tensor/TensorBuilder.java index 688cf23..a057138 100644 --- a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/tensor/TensorBuilder.java +++ b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/tensor/TensorBuilder.java @@ -99,6 +99,7 @@ Tensor build( * @throws IllegalArgumentException if the type of the {@link RandomAccessibleInterval} * is not supported */ + @SuppressWarnings("unchecked") public static > Tensor build( RandomAccessibleInterval array) throws IllegalArgumentException { @@ -123,16 +124,6 @@ else if (Util.getTypeFromInterval(array) instanceof LongType) { } } - /** - * Creates a {@link Tensor} of type {@link TUint8} from an - * {@link RandomAccessibleInterval} of type {@link UnsignedByteType} - * - * @param tensor - * The {@link RandomAccessibleInterval} to fill the tensor with. - * @return The {@link Tensor} tensor filled with the {@link RandomAccessibleInterval} data. - * @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is - * not compatible - */ private static Tensor buildUByte( RandomAccessibleInterval tensor) throws IllegalArgumentException @@ -161,16 +152,6 @@ private static Tensor buildUByte( return ndarray; } - /** - * Creates a {@link Tensor} of type {@link TInt32} from an - * {@link RandomAccessibleInterval} of type {@link IntType} - * - * @param tensor - * The {@link RandomAccessibleInterval} to fill the tensor with. - * @return The {@link Tensor} tensor filled with the {@link RandomAccessibleInterval} data. - * @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is - * not compatible - */ private static Tensor buildInt( RandomAccessibleInterval tensor) throws IllegalArgumentException { @@ -198,16 +179,6 @@ private static Tensor buildInt( return ndarray; } - /** - * Creates a {@link Tensor} of type {@link TInt64} from an - * {@link RandomAccessibleInterval} of type {@link LongType} - * - * @param tensor - * The {@link RandomAccessibleInterval} to fill the tensor with. - * @return The {@link Tensor} tensor filled with the {@link RandomAccessibleInterval} data. - * @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is - * not compatible - */ private static Tensor buildLong( RandomAccessibleInterval tensor) throws IllegalArgumentException @@ -236,16 +207,6 @@ private static Tensor buildLong( return ndarray; } - /** - * Creates a {@link Tensor} of type {@link TFloat32} from an - * {@link RandomAccessibleInterval} of type {@link FloatType} - * - * @param tensor - * The {@link RandomAccessibleInterval} to fill the tensor with. - * @return The {@link Tensor} tensor filled with the {@link RandomAccessibleInterval} data. - * @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is - * not compatible - */ private static Tensor buildFloat( RandomAccessibleInterval tensor) throws IllegalArgumentException @@ -274,16 +235,6 @@ private static Tensor buildFloat( return ndarray; } - /** - * Creates a {@link Tensor} of type {@link TFloat64} from an - * {@link RandomAccessibleInterval} of type {@link DoubleType} - * - * @param tensor - * The {@link RandomAccessibleInterval} to fill the tensor with. - * @return The {@link Tensor} tensor filled with the {@link RandomAccessibleInterval} data. - * @throws IllegalArgumentException if the input {@link RandomAccessibleInterval} type is - * not compatible - */ private static Tensor buildDouble( RandomAccessibleInterval tensor) throws IllegalArgumentException