Java Code Examples for org.deeplearning4j.nn.workspace.LayerWorkspaceMgr#hasConfiguration()
The following examples show how to use
org.deeplearning4j.nn.workspace.LayerWorkspaceMgr#hasConfiguration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepeatVector.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr) { assertInputSet(false); if (cacheMode == null) cacheMode = CacheMode.NONE; INDArray z = preOutput(training, false, workspaceMgr); if (training && cacheMode != CacheMode.NONE && workspaceMgr.hasConfiguration(ArrayType.FF_CACHE) && workspaceMgr.isWorkspaceOpen(ArrayType.FF_CACHE)) { try (MemoryWorkspace wsB = workspaceMgr.notifyScopeBorrowed(ArrayType.FF_CACHE)) { preOutput = z.unsafeDuplication(); } } return z; }
Example 2
Source File: Upsampling3D.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr) { assertInputSet(false); applyDropOutIfNecessary(training, workspaceMgr); if (cacheMode == null) cacheMode = CacheMode.NONE; INDArray z = preOutput(training, false, workspaceMgr); // we do cache only if cache workspace exists. Skip otherwise if (training && cacheMode != CacheMode.NONE && workspaceMgr.hasConfiguration(ArrayType.FF_CACHE) && workspaceMgr.isWorkspaceOpen(ArrayType.FF_CACHE)) { try (MemoryWorkspace wsB = workspaceMgr.notifyScopeBorrowed(ArrayType.FF_CACHE)) { preOutput = z.unsafeDuplication(); } } return z; }
Example 3
Source File: Upsampling2D.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr) { assertInputSet(false); applyDropOutIfNecessary(training, workspaceMgr); if (cacheMode == null) cacheMode = CacheMode.NONE; INDArray z = preOutput(training, false, workspaceMgr); // we do cache only if cache workspace exists. Skip otherwise if (training && cacheMode != CacheMode.NONE && workspaceMgr.hasConfiguration(ArrayType.FF_CACHE) && workspaceMgr.isWorkspaceOpen(ArrayType.FF_CACHE)) { try (MemoryWorkspace wsB = workspaceMgr.notifyScopeBorrowed(ArrayType.FF_CACHE)) { preOutput = z.unsafeDuplication(); } } return z; }
Example 4
Source File: LSTMHelpers.java From deeplearning4j with Apache License 2.0 | 4 votes |
private static boolean shouldCache(boolean training, CacheMode cacheMode, LayerWorkspaceMgr workspaceMgr){ return training && cacheMode != CacheMode.NONE && workspaceMgr.hasConfiguration(ArrayType.FF_CACHE) && workspaceMgr.isWorkspaceOpen(ArrayType.FF_CACHE); }