Class MemoryReport
- java.lang.Object
-
- org.deeplearning4j.nn.conf.memory.MemoryReport
-
- Direct Known Subclasses:
LayerMemoryReport
,NetworkMemoryReport
public abstract class MemoryReport extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static Map<CacheMode,Long>
CACHE_MODE_ALL_ZEROS
A simple Map containing all zeros for each CacheMode key
-
Constructor Summary
Constructors Constructor Description MemoryReport()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Map<CacheMode,Long>
cacheModeMapFor(long value)
Get a map of CacheMode with all keys associated with the specified valuestatic MemoryReport
fromJson(String json)
static MemoryReport
fromYaml(String yaml)
protected int
getBytesPerElement(DataType dataType)
long
getMemoryBytes(MemoryType memoryType, int minibatchSize, MemoryUseMode memoryUseMode, CacheMode cacheMode)
Get the memory estimate (in bytes) for the specified type of memory, using the current ND4J data typeabstract long
getMemoryBytes(MemoryType memoryType, int minibatchSize, MemoryUseMode memoryUseMode, CacheMode cacheMode, DataType dataType)
Get the memory estimate (in bytes) for the specified type of memoryabstract String
getName()
Name of the object that the memory report was generated forabstract Class<?>
getReportClass()
long
getTotalMemoryBytes(int minibatchSize, @NonNull MemoryUseMode memoryUseMode, @NonNull CacheMode cacheMode)
Get the total memory use in bytes for the given configuration (using the current ND4J data type)abstract long
getTotalMemoryBytes(int minibatchSize, @NonNull MemoryUseMode memoryUseMode, @NonNull CacheMode cacheMode, @NonNull DataType dataType)
Get the total memory use in bytes for the given configurationString
toJson()
abstract String
toString()
String
toYaml()
-
-
-
Method Detail
-
getReportClass
public abstract Class<?> getReportClass()
- Returns:
- Class that the memory report was generated for
-
getName
public abstract String getName()
Name of the object that the memory report was generated for- Returns:
- Name of the object
-
getTotalMemoryBytes
public long getTotalMemoryBytes(int minibatchSize, @NonNull @NonNull MemoryUseMode memoryUseMode, @NonNull @NonNull CacheMode cacheMode)
Get the total memory use in bytes for the given configuration (using the current ND4J data type)- Parameters:
minibatchSize
- Mini batch size to estimate the memory formemoryUseMode
- The memory use mode (training or inference)cacheMode
- The CacheMode to use- Returns:
- The estimated total memory consumption in bytes
-
getTotalMemoryBytes
public abstract long getTotalMemoryBytes(int minibatchSize, @NonNull @NonNull MemoryUseMode memoryUseMode, @NonNull @NonNull CacheMode cacheMode, @NonNull @NonNull DataType dataType)
Get the total memory use in bytes for the given configuration- Parameters:
minibatchSize
- Mini batch size to estimate the memory formemoryUseMode
- The memory use mode (training or inference)cacheMode
- The CacheMode to usedataType
- Nd4j datatype- Returns:
- The estimated total memory consumption in bytes
-
getMemoryBytes
public long getMemoryBytes(MemoryType memoryType, int minibatchSize, MemoryUseMode memoryUseMode, CacheMode cacheMode)
Get the memory estimate (in bytes) for the specified type of memory, using the current ND4J data type- Parameters:
memoryType
- Type of memory to get the estimate for invitesminibatchSize
- Mini batch size to estimate the memory formemoryUseMode
- The memory use mode (training or inference)cacheMode
- The CacheMode to use- Returns:
- Estimated memory use for the given memory type
-
getMemoryBytes
public abstract long getMemoryBytes(MemoryType memoryType, int minibatchSize, MemoryUseMode memoryUseMode, CacheMode cacheMode, DataType dataType)
Get the memory estimate (in bytes) for the specified type of memory- Parameters:
memoryType
- Type of memory to get the estimate for invitesminibatchSize
- Mini batch size to estimate the memory formemoryUseMode
- The memory use mode (training or inference)cacheMode
- The CacheMode to usedataType
- Nd4j datatype- Returns:
- Estimated memory use for the given memory type
-
getBytesPerElement
protected int getBytesPerElement(DataType dataType)
-
cacheModeMapFor
public static Map<CacheMode,Long> cacheModeMapFor(long value)
Get a map of CacheMode with all keys associated with the specified value- Parameters:
value
- Value for all keys- Returns:
- Map
-
toJson
public String toJson()
-
toYaml
public String toYaml()
-
fromJson
public static MemoryReport fromJson(String json)
-
fromYaml
public static MemoryReport fromYaml(String yaml)
-
-