@Test public void testDoubleDeviceAllocation() throws Exception{ if(!"CUDA".equalsIgnoreCase(Nd4j.getExecutioner().getEnvironmentInformation().getProperty("backend"))){ return; } INDArray arr = Nd4j.rand(3, 2); ((BaseDataBuffer)arr.data()).syncToPrimary(); long deviceAddress1 = getDeviceAddress(arr); PythonVariables pyInputs = new PythonVariables(); pyInputs.addNDArray("arr", arr); PythonVariables pyOutputs = new PythonVariables(); pyOutputs.addNDArray("arr"); String code = "arr += 2"; Python.exec(code, pyInputs, pyOutputs); INDArray arr2 = pyOutputs.getNDArrayValue("arr"); long deviceAddress2 = getDeviceAddress(arr2); Assert.assertEquals(deviceAddress1, deviceAddress2); }
public static void exec(String code) throws PythonException { simpleExec(getWrappedCode(code)); throwIfExecutionFailed(); }
PythonExecutioner { public static void exec(String code) throws PythonException { simpleExec(getWrappedCode(code)); throwIfExecutionFailed(); } }
PythonExecutioner { public static void exec(String code) throws PythonException { simpleExec(getWrappedCode(code)); throwIfExecutionFailed(); }  }
PythonExecutioner { public static void exec(String code) throws PythonException { simpleExec(getWrappedCode(code)); throwIfExecutionFailed(); }  static boolean validateVariableName(String s); static void setVariable(String varName, PythonObject pythonObject); static void setVariable(String varName, PythonType varType, Object value); static void setVariables(PythonVariables pyVars); static PythonObject getVariable(String varName); static T getVariable(String varName, PythonType<T> varType); static void getVariables(PythonVariables pyVars); static void exec(String code); static void exec(String code, PythonVariables inputVariables, PythonVariables outputVariables); static PythonVariables execAndReturnAllVariables(String code); static PythonVariables getAllVariables(); static PythonVariables execAndReturnAllVariables(String code, PythonVariables inputs); static synchronized void initPythonPath(); }
PythonExecutioner { public static void exec(String code) throws PythonException { simpleExec(getWrappedCode(code)); throwIfExecutionFailed(); }  static boolean validateVariableName(String s); static void setVariable(String varName, PythonObject pythonObject); static void setVariable(String varName, PythonType varType, Object value); static void setVariables(PythonVariables pyVars); static PythonObject getVariable(String varName); static T getVariable(String varName, PythonType<T> varType); static void getVariables(PythonVariables pyVars); static void exec(String code); static void exec(String code, PythonVariables inputVariables, PythonVariables outputVariables); static PythonVariables execAndReturnAllVariables(String code); static PythonVariables getAllVariables(); static PythonVariables execAndReturnAllVariables(String code, PythonVariables inputs); static synchronized void initPythonPath(); final static String DEFAULT_PYTHON_PATH_PROPERTY; final static String JAVACPP_PYTHON_APPEND_TYPE; final static String DEFAULT_APPEND_TYPE; }