return this; if (!Nd4j.getWorkspaceManager().checkIfWorkspaceExists(id)) { if(enforceExistence){ throw new Nd4jNoSuchWorkspaceException(id);
if (Nd4j.getWorkspaceManager().checkIfWorkspaceExists(ComputationGraph.workspaceFeedForward)) { try (MemoryWorkspace workspace = Nd4j.getWorkspaceManager() .getAndActivateWorkspace(ComputationGraph.workspaceFeedForward)) {
@Override public INDArray activate(boolean training) { if (input == null) { throw new IllegalArgumentException("Cannot perform forward pass with null input " + layerId()); } if (cacheMode == null) cacheMode = CacheMode.NONE; applyDropOutIfNecessary(training); INDArray z = preOutput(training); // we do cache only if cache workspace exists. Skip otherwise if (training && cacheMode != CacheMode.NONE && Nd4j.getWorkspaceManager().checkIfWorkspaceExists(ComputationGraph.workspaceCache)) { try (MemoryWorkspace wsB = Nd4j.getWorkspaceManager() .getWorkspaceForCurrentThread(ComputationGraph.workspaceCache).notifyScopeBorrowed()) { preOutput = z.unsafeDuplication(); } } //String afn = conf.getLayer().getActivationFunction(); IActivation afn = layerConf().getActivationFn(); if (helper != null) { INDArray ret = helper.activate(z, layerConf().getActivationFn()); if (ret != null) { return ret; } } INDArray activation = afn.getActivation(z, training); return activation; }
protected void applyDropOutIfNecessary(boolean training) { if (layerConf().getDropOut() > 0 && !conf.isUseDropConnect() && training && !dropoutApplied) { if (Nd4j.getWorkspaceManager().checkIfWorkspaceExists(ComputationGraph.workspaceExternal)) { try (MemoryWorkspace ws = Nd4j.getWorkspaceManager() .getWorkspaceForCurrentThread(ComputationGraph.workspaceExternal) .notifyScopeBorrowed()) { input = input.isView() ? input.dup() : input.unsafeDuplication(); } } else input = input.isView() ? input.dup() : input.unsafeDuplication(); Dropout.applyDropout(input, layerConf().getDropOut()); dropoutApplied = true; } }
if (Nd4j.getWorkspaceManager().checkIfWorkspaceExists(workspaceExternal) && Nd4j.getMemoryManager().getCurrentWorkspace() != Nd4j.getWorkspaceManager() .getWorkspaceForCurrentThread( int inputNum = v.getVertexEdgeNumber(); if (Nd4j.getWorkspaceManager().checkIfWorkspaceExists(workspaceExternal) && Nd4j.getMemoryManager().getCurrentWorkspace() != Nd4j .getWorkspaceManager().getWorkspaceForCurrentThread(
return this; if (!Nd4j.getWorkspaceManager().checkIfWorkspaceExists(id)) return this;
if (Nd4j.getWorkspaceManager().checkIfWorkspaceExists(ComputationGraph.workspacePretrain)) layerInput = activationFromPrevLayer(j, layerInput, true) .leverageTo(ComputationGraph.workspacePretrain);
if (Nd4j.getWorkspaceManager().checkIfWorkspaceExists(ComputationGraph.workspaceExternal) && Nd4j.getMemoryManager().getCurrentWorkspace() != Nd4j.getWorkspaceManager() .getWorkspaceForCurrentThread(ComputationGraph.workspaceExternal)) { && Nd4j.getWorkspaceManager().checkIfWorkspaceExists(ComputationGraph.workspaceCache)) {
if (Nd4j.getWorkspaceManager().checkIfWorkspaceExists(ComputationGraph.workspaceExternal) && Nd4j.getMemoryManager().getCurrentWorkspace() != Nd4j.getWorkspaceManager() .getWorkspaceForCurrentThread(ComputationGraph.workspaceExternal)) {
if (!Nd4j.getWorkspaceManager().checkIfWorkspaceExists(id)) {
if (!Nd4j.getWorkspaceManager().checkIfWorkspaceExists(id)) {