Skip to content

Commit

Permalink
remove methods that save a npy array
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Jan 3, 2025
1 parent 87ffcbd commit 3ca1b08
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import io.bioimage.modelrunner.engine.DeepLearningEngineInterface;
import io.bioimage.modelrunner.exceptions.LoadModelException;
import io.bioimage.modelrunner.exceptions.RunModelException;
import io.bioimage.modelrunner.numpy.DecodeNumpy;
import io.bioimage.modelrunner.pytorch.shm.ShmBuilder;
import io.bioimage.modelrunner.pytorch.shm.TensorBuilder;
import io.bioimage.modelrunner.pytorch.tensor.ImgLib2Builder;
Expand Down Expand Up @@ -60,7 +59,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.google.gson.Gson;

Expand Down Expand Up @@ -276,7 +274,6 @@ protected void runFromShmas(List<String> inputs, List<String> outputs) throws IO
for (String ee : inputs) {
Map<String, Object> decoded = Types.decode(ee);
SharedMemoryArray shma = SharedMemoryArray.read((String) decoded.get(MEM_NAME_KEY));
DecodeNumpy.saveNpy("/home/carlos/git/mm_in" + UUID.randomUUID().toString() + ".npy", Cast.unchecked(shma.getSharedRAI()));
NDArray inT = TensorBuilder.build(shma, manager);
if (PlatformDetection.isWindows()) shma.close();
inputList.add(inT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,19 @@
*/
package io.bioimage.modelrunner.pytorch.shm;

import io.bioimage.modelrunner.numpy.DecodeNumpy;
import io.bioimage.modelrunner.system.PlatformDetection;
import io.bioimage.modelrunner.tensor.shm.SharedMemoryArray;
import io.bioimage.modelrunner.utils.CommonUtils;

import java.io.IOException;
import java.util.Arrays;
import java.util.UUID;

import ai.djl.ndarray.NDArray;
import net.imglib2.type.numeric.integer.IntType;
import net.imglib2.type.numeric.integer.LongType;
import net.imglib2.type.numeric.integer.UnsignedByteType;
import net.imglib2.type.numeric.real.DoubleType;
import net.imglib2.type.numeric.real.FloatType;
import net.imglib2.util.Cast;

/**
* A utility class that converts {@link NDArray}s into {@link SharedMemoryArray}s for
Expand Down Expand Up @@ -117,7 +114,6 @@ private static void buildFromTensorFloat(NDArray tensor, String memoryName) thro

SharedMemoryArray shma = SharedMemoryArray.readOrCreate(memoryName, arrayShape, new FloatType(), false, true);
shma.getDataBufferNoHeader().put(tensor.toByteArray());
DecodeNumpy.saveNpy("/home/carlos/git/mm_out" + UUID.randomUUID().toString() + ".npy", Cast.unchecked(shma.getSharedRAI()));
if (PlatformDetection.isWindows()) shma.close();
}

Expand Down

0 comments on commit 3ca1b08

Please sign in to comment.