raver119 2020-05-09 08:09:26 +03:00 committed by GitHub
parent 320924278d
commit 2849299bfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -5341,7 +5341,7 @@ public abstract class BaseNDArray implements INDArray, Iterable {
if (!this.isView()) {
Nd4j.getExecutioner().commit();
DataBuffer buffer = Nd4j.createBuffer(this.length(), false);
DataBuffer buffer = Nd4j.createBuffer(this.dataType(), this.length(), false);
Nd4j.getMemoryManager().memcpy(buffer, this.data());
copy = Nd4j.createArrayFromShapeBuffer(buffer, this.shapeInfoDataBuffer());

View File

@ -425,6 +425,21 @@ public class SpecialWorkspaceTests extends BaseNd4jTest {
Files.delete(tmpFile);
}
@Test
public void testMigrateToWorkspace(){
val src = Nd4j.createFromArray (1L,2L);
val wsConf = new WorkspaceConfiguration().builder().build();
Nd4j.getWorkspaceManager().createNewWorkspace(wsConf,"testWS");
val ws = Nd4j.getWorkspaceManager().getAndActivateWorkspace("testWS");
val migrated = src.migrate();
assertEquals(src.dataType(), migrated.dataType());
assertEquals(1L, migrated.getLong(0));
ws.close();
}
@Override
public char ordering() {
return 'c';