configuration.getTrainingWorkspaceMode(), configuration.getInferenceWorkspaceMode());
/** * Return an array of network outputs (predictions), given the specified network inputs * Network outputs are for output layers only. * * @param train If true: do forward pass at training time; false: do forward pass at test time * @param input Inputs to the network * @return Output activations (order: same as defined in network configuration) */ public INDArray[] output(boolean train, INDArray... input) { WorkspaceMode cMode = configuration.getTrainingWorkspaceMode(); configuration.setTrainingWorkspaceMode(configuration.getInferenceWorkspaceMode()); MemoryWorkspace workspace = configuration.getTrainingWorkspaceMode() == WorkspaceMode.NONE ? new DummyWorkspace() : Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread( workspaceConfigurationExternal, workspaceExternal); try (MemoryWorkspace wsE = workspace.notifyScopeEntered()) { INDArray[] tmp = silentOutput(train, input); for (int x = 0; x < tmp.length; x++) tmp[x] = tmp[x].detach(); configuration.setTrainingWorkspaceMode(cMode); return tmp; } }
configuration.setTrainingWorkspaceMode(configuration.getInferenceWorkspaceMode());
configuration.setTrainingWorkspaceMode(configuration.getInferenceWorkspaceMode());