Skip to content

Commit faf2844

Browse files
committed
remove unnecessary code
1 parent 24c5a81 commit faf2844

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

Diff for: src/main/java/io/bioimage/modelrunner/tensorflow/v2/api020/Tensorflow2Interface.java

+2-43
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ protected void runFromShmas(List<String> inputs, List<String> outputs) throws IO
358358
void runInterprocessing(List<Tensor<T>> inputTensors, List<Tensor<R>> outputTensors) throws RunModelException {
359359
shmaInputList = new ArrayList<SharedMemoryArray>();
360360
shmaOutputList = new ArrayList<SharedMemoryArray>();
361-
List<String> encIns = modifyForWinCmd(encodeInputs(inputTensors));
362-
List<String> encOuts = modifyForWinCmd(encodeOutputs(outputTensors));
361+
List<String> encIns = encodeInputs(inputTensors);
362+
List<String> encOuts = encodeOutputs(outputTensors);
363363
LinkedHashMap<String, Object> args = new LinkedHashMap<String, Object>();
364364
args.put("inputs", encIns);
365365
args.put("outputs", encOuts);
@@ -407,15 +407,6 @@ private void closeShmas() {
407407
shmaOutputList = null;
408408
}
409409

410-
private static List<String> modifyForWinCmd(List<String> ins){
411-
if (!PlatformDetection.isWindows())
412-
return ins;
413-
List<String> newIns = new ArrayList<String>();
414-
for (String ii : ins)
415-
newIns.add("\"" + ii.replace("\"", "\\\"") + "\"");
416-
return newIns;
417-
}
418-
419410

420411
private <T extends RealType<T> & NativeType<T>> List<String> encodeInputs(List<Tensor<T>> inputTensors) {
421412
List<String> encodedInputTensors = new ArrayList<String>();
@@ -703,36 +694,4 @@ private static String getPathFromClass(Class<?> clazz) throws UnsupportedEncodin
703694
path = path.substring(0, path.lastIndexOf(".jar!")) + ".jar";
704695
return path;
705696
}
706-
707-
/**
708-
* GEt the directory where the TF2 engine is located if a temporary dir is not found
709-
* @return directory of the engines
710-
*/
711-
private static String getEnginesDir() {
712-
String dir;
713-
try {
714-
dir = getPathFromClass(Tensorflow2Interface.class);
715-
} catch (UnsupportedEncodingException e) {
716-
String classResource = Tensorflow2Interface.class.getName().replace('.', '/') + ".class";
717-
URL resourceUrl = Tensorflow2Interface.class.getClassLoader().getResource(classResource);
718-
if (resourceUrl == null) {
719-
return null;
720-
}
721-
String urlString = resourceUrl.toString();
722-
if (urlString.startsWith("jar:")) {
723-
urlString = urlString.substring(4);
724-
}
725-
if (urlString.startsWith("file:/") && PlatformDetection.isWindows()) {
726-
urlString = urlString.substring(6);
727-
} else if (urlString.startsWith("file:/") && !PlatformDetection.isWindows()) {
728-
urlString = urlString.substring(5);
729-
}
730-
File file = new File(urlString);
731-
String path = file.getAbsolutePath();
732-
if (path.lastIndexOf(".jar!") != -1)
733-
path = path.substring(0, path.lastIndexOf(".jar!")) + ".jar";
734-
dir = path;
735-
}
736-
return new File(dir).getParent();
737-
}
738697
}

0 commit comments

Comments
 (0)