@@ -291,8 +291,8 @@ protected void runFromShmas(List<String> inputs, List<String> outputs) throws IO
291291 void runInterprocessing (List <Tensor <T >> inputTensors , List <Tensor <R >> outputTensors ) throws RunModelException {
292292 shmaInputList = new ArrayList <SharedMemoryArray >();
293293 shmaOutputList = new ArrayList <SharedMemoryArray >();
294- List <String > encIns = modifyForWinCmd ( encodeInputs (inputTensors ) );
295- List <String > encOuts = modifyForWinCmd ( encodeOutputs (outputTensors ) );
294+ List <String > encIns = encodeInputs (inputTensors );
295+ List <String > encOuts = encodeOutputs (outputTensors );
296296 LinkedHashMap <String , Object > args = new LinkedHashMap <String , Object >();
297297 args .put ("inputs" , encIns );
298298 args .put ("outputs" , encOuts );
@@ -339,16 +339,6 @@ private void closeShmas() {
339339 });
340340 shmaOutputList = null ;
341341 }
342-
343- private static List <String > modifyForWinCmd (List <String > ins ){
344- if (!PlatformDetection .isWindows ())
345- return ins ;
346- List <String > newIns = new ArrayList <String >();
347- for (String ii : ins )
348- newIns .add ("\" " + ii .replace ("\" " , "\\ \" " ) + "\" " );
349- return newIns ;
350- }
351-
352342
353343 /**
354344 * {@inheritDoc}
@@ -507,48 +497,6 @@ private static String getCurrentClasspath() throws UnsupportedEncodingException
507497 return classpath ;
508498 }
509499
510- /**
511- * Create the arguments needed to execute Pytorch in another
512- * process with the corresponding tensors
513- * @return the command used to call the separate process
514- * @throws IOException if the command needed to execute interprocessing is too long
515- * @throws URISyntaxException if there is any error with the URIs retrieved from the classes
516- */
517- private List <String > getProcessCommandsWithoutArgs2 () throws IOException , URISyntaxException {
518- String javaHome = System .getProperty ("java.home" );
519- String javaBin = javaHome + File .separator + "bin" + File .separator + "java" ;
520-
521- String modelrunnerPath = getPathFromClass (DeepLearningEngineInterface .class );
522- String imglib2Path = getPathFromClass (NativeType .class );
523- String gsonPath = getPathFromClass (Gson .class );
524- String jnaPath = getPathFromClass (com .sun .jna .Library .class );
525- String jnaPlatformPath = getPathFromClass (com .sun .jna .platform .FileUtils .class );
526- if (modelrunnerPath == null || (modelrunnerPath .endsWith ("DeepLearningEngineInterface.class" )
527- && !modelrunnerPath .contains (File .pathSeparator )))
528- modelrunnerPath = System .getProperty ("java.class.path" );
529- String classpath = modelrunnerPath + File .pathSeparator + imglib2Path + File .pathSeparator ;
530- classpath = classpath + gsonPath + File .pathSeparator ;
531- classpath = classpath + jnaPath + File .pathSeparator ;
532- classpath = classpath + jnaPlatformPath + File .pathSeparator ;
533- ProtectionDomain protectionDomain = PytorchJavaCPPInterface .class .getProtectionDomain ();
534- String codeSource = protectionDomain .getCodeSource ().getLocation ().getPath ();
535- String f_name = URLDecoder .decode (codeSource , StandardCharsets .UTF_8 .toString ());
536- f_name = new File (f_name ).getAbsolutePath ();
537- for (File ff : new File (f_name ).getParentFile ().listFiles ()) {
538- if (ff .getName ().startsWith (JAR_FILE_NAME ) && !ff .getAbsolutePath ().equals (f_name ))
539- continue ;
540- classpath += ff .getAbsolutePath () + File .pathSeparator ;
541- }
542- String className = PytorchJavaCPPInterface .class .getName ();
543- List <String > command = new LinkedList <String >();
544- command .add (padSpecialJavaBin (javaBin ));
545- command .add ("-cp" );
546- command .add (classpath );
547- command .add (className );
548- command .add (modelSource );
549- return command ;
550- }
551-
552500 /**
553501 * Method that gets the path to the JAR from where a specific class is being loaded
554502 * @param clazz
0 commit comments