Interface SessionMemMgr
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
AbstractMemoryMgr
,ArrayCacheMemoryMgr
,NoOpMemoryMgr
public interface SessionMemMgr extends Closeable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description INDArray
allocate(boolean detached, DataType dataType, long... shape)
Allocate an array with the specified datatype and shape.
NOTE: This array should be assumed to be uninitialized - i.e., contains random values.INDArray
allocate(boolean detached, LongShapeDescriptor descriptor)
As perallocate(boolean, DataType, long...)
but from a LongShapeDescriptor insteadvoid
close()
Close the session memory manager and clean up any memory / resources, if anyINDArray
dup(INDArray arr)
Duplicate the specified array, to an array that is managed/allocated by the session memory managervoid
release(INDArray array)
Release the array.INDArray
ulike(INDArray arr)
Allocate an uninitialized array with the same datatype and shape as the specified array
-
-
-
Method Detail
-
allocate
INDArray allocate(boolean detached, DataType dataType, long... shape)
Allocate an array with the specified datatype and shape.
NOTE: This array should be assumed to be uninitialized - i.e., contains random values.- Parameters:
detached
- If true: the array is safe to return outside of the SameDiff session run (for example, the array is one that may be returned to the user)dataType
- Datatype of the returned arrayshape
- Array shape- Returns:
- The newly allocated (uninitialized) array
-
allocate
INDArray allocate(boolean detached, LongShapeDescriptor descriptor)
As perallocate(boolean, DataType, long...)
but from a LongShapeDescriptor instead
-
ulike
INDArray ulike(INDArray arr)
Allocate an uninitialized array with the same datatype and shape as the specified array
-
dup
INDArray dup(INDArray arr)
Duplicate the specified array, to an array that is managed/allocated by the session memory manager
-
release
void release(INDArray array)
Release the array. All arrays allocated via one of the allocate methods should be returned here once they are no longer used, and all references to them should be cleared. After calling release, anything could occur to the array - deallocated, workspace closed, reused, etc.- Parameters:
array
- The array that can be released
-
close
void close()
Close the session memory manager and clean up any memory / resources, if any- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-