Skip to content

Commit

Permalink
improve javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 1, 2024
1 parent 45bc153 commit d123975
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ public static <T extends Type<T>> RandomAccessibleInterval<T> build(Tensor<? ext
}
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned byte-typed {@link TUint8} tensor.
*
* @param tensor
* The {@link TUint8} tensor data is read from.
* @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link UnsignedByteType}.
*/
private static RandomAccessibleInterval<UnsignedByteType> buildFromTensorUByte(Tensor<TUint8> tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand All @@ -110,13 +103,6 @@ private static RandomAccessibleInterval<UnsignedByteType> 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<IntType> buildFromTensorInt(Tensor<TInt32> tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand All @@ -133,13 +119,6 @@ private static RandomAccessibleInterval<IntType> buildFromTensorInt(Tensor<TInt3
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned float32-typed {@link TFloat32} tensor.
*
* @param tensor
* The {@link TFloat32} tensor data is read from.
* @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link FloatType}.
*/
private static RandomAccessibleInterval<FloatType> buildFromTensorFloat(Tensor<TFloat32> tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand All @@ -156,13 +135,6 @@ private static RandomAccessibleInterval<FloatType> buildFromTensorFloat(Tensor<T
return Utils.transpose(rai);
}

/**
* Builds a {@link RandomAccessibleInterval} from a unsigned float64-typed {@link TFloat64} tensor.
*
* @param tensor
* The {@link TFloat64} tensor data is read from.
* @return The {@link RandomAccessibleInterval} built from the tensor, of type {@link DoubleType}.
*/
private static RandomAccessibleInterval<DoubleType> buildFromTensorDouble(Tensor<TFloat64> tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand All @@ -179,13 +151,6 @@ private static RandomAccessibleInterval<DoubleType> 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<LongType> buildFromTensorLong(Tensor<TInt64> tensor)
{
long[] arrayShape = tensor.shape().asArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Tensor<? extends TType> build(
* @throws IllegalArgumentException if the type of the {@link RandomAccessibleInterval}
* is not supported
*/
@SuppressWarnings("unchecked")
public static <T extends Type<T>> Tensor<? extends TType> build(
RandomAccessibleInterval<T> array) throws IllegalArgumentException
{
Expand All @@ -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<TUint8> buildUByte(
RandomAccessibleInterval<UnsignedByteType> tensor)
throws IllegalArgumentException
Expand Down Expand Up @@ -161,16 +152,6 @@ private static Tensor<TUint8> 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<TInt32> buildInt(
RandomAccessibleInterval<IntType> tensor) throws IllegalArgumentException
{
Expand Down Expand Up @@ -198,16 +179,6 @@ private static Tensor<TInt32> 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<TInt64> buildLong(
RandomAccessibleInterval<LongType> tensor)
throws IllegalArgumentException
Expand Down Expand Up @@ -236,16 +207,6 @@ private static Tensor<TInt64> 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<TFloat32> buildFloat(
RandomAccessibleInterval<FloatType> tensor)
throws IllegalArgumentException
Expand Down Expand Up @@ -274,16 +235,6 @@ private static Tensor<TFloat32> 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<TFloat64> buildDouble(
RandomAccessibleInterval<DoubleType> tensor)
throws IllegalArgumentException
Expand Down

0 comments on commit d123975

Please sign in to comment.