@@ -358,8 +358,8 @@ protected void runFromShmas(List<String> inputs, List<String> outputs) throws IO
358
358
void runInterprocessing (List <Tensor <T >> inputTensors , List <Tensor <R >> outputTensors ) throws RunModelException {
359
359
shmaInputList = new ArrayList <SharedMemoryArray >();
360
360
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 );
363
363
LinkedHashMap <String , Object > args = new LinkedHashMap <String , Object >();
364
364
args .put ("inputs" , encIns );
365
365
args .put ("outputs" , encOuts );
@@ -407,15 +407,6 @@ private void closeShmas() {
407
407
shmaOutputList = null ;
408
408
}
409
409
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
-
419
410
420
411
private <T extends RealType <T > & NativeType <T >> List <String > encodeInputs (List <Tensor <T >> inputTensors ) {
421
412
List <String > encodedInputTensors = new ArrayList <String >();
@@ -703,36 +694,4 @@ private static String getPathFromClass(Class<?> clazz) throws UnsupportedEncodin
703
694
path = path .substring (0 , path .lastIndexOf (".jar!" )) + ".jar" ;
704
695
return path ;
705
696
}
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
- }
738
697
}
0 commit comments