use of org.nd4j.linalg.memory.abstracts.Nd4jWorkspace in project nd4j by deeplearning4j.
the class WorkspaceProviderTests method testNestedWorkspaces8.
@Test
public void testNestedWorkspaces8() throws Exception {
try (MemoryWorkspace ws = Nd4j.getWorkspaceManager().getAndActivateWorkspace(loopConfiguration, "WS_1")) {
INDArray array = Nd4j.create(100);
}
Nd4jWorkspace workspace = (Nd4jWorkspace) Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread(loopConfiguration, "WS_1");
workspace.initializeWorkspace();
assertEquals(100 * Nd4j.sizeOfDataType(), workspace.getCurrentSize());
try (MemoryWorkspace ws = Nd4j.getWorkspaceManager().getAndActivateWorkspace(loopConfiguration, "WS_1")) {
INDArray array = Nd4j.create(1000);
}
Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread(loopConfiguration, "WS_1").initializeWorkspace();
assertEquals(100 * Nd4j.sizeOfDataType(), workspace.getCurrentSize());
}
Aggregations