From c35f367f33af5f85b90b70f4484847e08ab47470 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Mon, 30 Sep 2024 18:18:04 +0200 Subject: [PATCH] remove more casting errors that fail at compilation --- .../example/ExampleLoadAndRunModel.java | 8 ++++---- .../example/ExampleLoadPytorch1Pytorch2.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/io/bioimage/modelrunner/example/ExampleLoadAndRunModel.java b/src/main/java/io/bioimage/modelrunner/example/ExampleLoadAndRunModel.java index ccf4ac5d..6d5325ab 100644 --- a/src/main/java/io/bioimage/modelrunner/example/ExampleLoadAndRunModel.java +++ b/src/main/java/io/bioimage/modelrunner/example/ExampleLoadAndRunModel.java @@ -112,8 +112,8 @@ void main(String[] args) throws LoadEngineException, Exception { // Create the input tensor with the nameand axes given by the rdf.yaml file // and add it to the list of input tensors Tensor inpTensor = Tensor.build("input0", "bcyx", img1); - List> inputs = new ArrayList>(); - inputs.add((Tensor) inpTensor); + List> inputs = new ArrayList>(); + inputs.add(inpTensor); // Create the output tensors defined in the rdf.yaml file with their corresponding // name and axes and add them to the output list of tensors. @@ -126,8 +126,8 @@ void main(String[] args) throws LoadEngineException, Exception { new FloatType());*/ final Img< FloatType > img2 = imgFactory.create( 1, 2, 512, 512 ); Tensor outTensor = Tensor.build("output0", "bcyx", img2); - List> outputs = new ArrayList>(); - outputs.add((Tensor) outTensor); + List> outputs = new ArrayList>(); + outputs.add(outTensor); // Run the model on the input tensors. THe output tensors // will be rewritten with the result of the execution diff --git a/src/main/java/io/bioimage/modelrunner/example/ExampleLoadPytorch1Pytorch2.java b/src/main/java/io/bioimage/modelrunner/example/ExampleLoadPytorch1Pytorch2.java index 429e18e2..91d2381e 100644 --- a/src/main/java/io/bioimage/modelrunner/example/ExampleLoadPytorch1Pytorch2.java +++ b/src/main/java/io/bioimage/modelrunner/example/ExampleLoadPytorch1Pytorch2.java @@ -126,8 +126,8 @@ void loadAndRunPt2(String modelFolder, String modelSource) throws LoadEngineExce // Create the input tensor with the nameand axes given by the rdf.yaml file // and add it to the list of input tensors Tensor inpTensor = Tensor.build("input0", "bcyx", img1); - List> inputs = new ArrayList>(); - inputs.add((Tensor) inpTensor); + List> inputs = new ArrayList>(); + inputs.add(inpTensor); // Create the output tensors defined in the rdf.yaml file with their corresponding // name and axes and add them to the output list of tensors. @@ -140,8 +140,8 @@ void loadAndRunPt2(String modelFolder, String modelSource) throws LoadEngineExce new FloatType());*/ final Img< FloatType > img2 = imgFactory.create( 1, 2, 512, 512 ); Tensor outTensor = Tensor.build("output0", "bcyx", img2); - List> outputs = new ArrayList>(); - outputs.add((Tensor) outTensor); + List> outputs = new ArrayList>(); + outputs.add(outTensor); // Run the model on the input tensors. THe output tensors // will be rewritten with the result of the execution @@ -197,8 +197,8 @@ void loadAndRunPt1(String modelFolder, String modelSource) throws LoadEngineExce // Create the input tensor with the nameand axes given by the rdf.yaml file // and add it to the list of input tensors Tensor inpTensor = Tensor.build("input0", "bcyx", img1); - List> inputs = new ArrayList>(); - inputs.add((Tensor) inpTensor); + List> inputs = new ArrayList>(); + inputs.add(inpTensor); // Create the output tensors defined in the rdf.yaml file with their corresponding // name and axes and add them to the output list of tensors. @@ -211,8 +211,8 @@ void loadAndRunPt1(String modelFolder, String modelSource) throws LoadEngineExce new FloatType());*/ final Img< FloatType > img2 = imgFactory.create( 1, 2, 512, 512 ); Tensor outTensor = Tensor.build("output0", "bcyx", img2); - List> outputs = new ArrayList>(); - outputs.add((Tensor) outTensor); + List> outputs = new ArrayList>(); + outputs.add(outTensor); // Run the model on the input tensors. THe output tensors // will be rewritten with the result of the execution