public class ArrayCacheMemoryMgr extends AbstractMemoryMgr
Pointer.maxBytes()
Modifier and Type | Class and Description |
---|---|
class |
ArrayCacheMemoryMgr.ArrayStore |
Constructor and Description |
---|
ArrayCacheMemoryMgr()
Create an ArrayCacheMemoryMgr with default settings as per
ArrayCacheMemoryMgr |
ArrayCacheMemoryMgr(double maxMemFrac,
long smallArrayThreshold,
double largerArrayMaxMultiple) |
Modifier and Type | Method and 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 per
SessionMemMgr.allocate(boolean, DataType, long...) but from a LongShapeDescriptor instead |
void |
close()
Close the session memory manager and clean up any memory / resources, if any
|
void |
release(@NonNull INDArray array)
Release the array.
|
dup, ulike
public ArrayCacheMemoryMgr()
ArrayCacheMemoryMgr
public ArrayCacheMemoryMgr(double maxMemFrac, long smallArrayThreshold, double largerArrayMaxMultiple)
maxMemFrac
- Maximum memory fraciton to use as cachesmallArrayThreshold
- Below this size (elements), don't apply the "largerArrayMaxMultiple" rulelargerArrayMaxMultiple
- Maximum multiple of the requested size to return from the cache. If an array of size
1024 is requested, and largerArrayMaxMultiple is 2.0, then we'll return from the cache
the array with the smallest data buffer up to 2.0*1024 elements; otherwise we'll return
a new arraypublic INDArray allocate(boolean detached, DataType dataType, long... shape)
SessionMemMgr
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 shapepublic INDArray allocate(boolean detached, LongShapeDescriptor descriptor)
SessionMemMgr
SessionMemMgr.allocate(boolean, DataType, long...)
but from a LongShapeDescriptor insteadpublic void release(@NonNull @NonNull INDArray array)
SessionMemMgr
array
- The array that can be releasedpublic void close()
SessionMemMgr
Copyright © 2020. All rights reserved.