Class MemoryReport

    • Field Detail

      • CACHE_MODE_ALL_ZEROS

        public static final Map<CacheMode,​Long> CACHE_MODE_ALL_ZEROS
        A simple Map containing all zeros for each CacheMode key
    • Constructor Detail

      • MemoryReport

        public MemoryReport()
    • 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 for
        memoryUseMode - 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 for
        memoryUseMode - The memory use mode (training or inference)
        cacheMode - The CacheMode to use
        dataType - 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 invites
        minibatchSize - Mini batch size to estimate the memory for
        memoryUseMode - 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 invites
        minibatchSize - Mini batch size to estimate the memory for
        memoryUseMode - The memory use mode (training or inference)
        cacheMode - The CacheMode to use
        dataType - 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()