Class LayerMemoryReport.Builder

    • Constructor Detail

      • Builder

        public Builder​(String layerName,
                       Class<?> layerType,
                       InputType inputType,
                       InputType outputType)
        Parameters:
        layerName - Name of the layer or graph vertex
        layerType - Type of the layer or graph vertex
        inputType - Input type to the layer/vertex
        outputType - Output type from the layer/vertex
    • Method Detail

      • standardMemory

        public LayerMemoryReport.Builder standardMemory​(long parameterSize,
                                                        long updaterStateSize)
        Report the standard memory
        Parameters:
        parameterSize - Number of parameters
        updaterStateSize - Size for the updater array
      • workingMemory

        public LayerMemoryReport.Builder workingMemory​(long fixedInference,
                                                       long variableInferencePerEx,
                                                       long fixedTrain,
                                                       long variableTrainPerEx)
        Report the working memory size, for both inference and training
        Parameters:
        fixedInference - Number of elements used for inference ( independent of minibatch size)
        variableInferencePerEx - Number of elements used for inference, for each example
        fixedTrain - Number of elements used for training (independent of minibatch size)
        variableTrainPerEx - Number of elements used for training, for each example
      • workingMemory

        public LayerMemoryReport.Builder workingMemory​(long fixedInference,
                                                       long variableInferencePerEx,
                                                       Map<CacheMode,​Long> fixedTrain,
                                                       Map<CacheMode,​Long> variableTrainPerEx)
        Report the working memory requirements, for both inference and training. As noted in MemoryReport Working memory is memory That will be allocated in a ND4J workspace, or can be garbage collected at any points after the method returns.
        Parameters:
        fixedInference - Number of elements of working memory used for inference (independent of minibatch size)
        variableInferencePerEx - Number of elements of working memory used for inference, for each example
        fixedTrain - Number of elements of working memory used for training (independent of minibatch size), for each cache mode
        variableTrainPerEx - Number of elements of working memory used for training, for each example, for each cache mode
      • cacheMemory

        public LayerMemoryReport.Builder cacheMemory​(long cacheModeMemoryFixed,
                                                     long cacheModeMemoryVariablePerEx)
        Reports the cached/cacheable memory requirements. This method assumes the caseload memory is the same for all cases, i.e., typically used with zeros (Layers that do not use caching)
        Parameters:
        cacheModeMemoryFixed - Number of elements of cache memory, independent of the mini batch size
        cacheModeMemoryVariablePerEx - Number of elements of cache memory, for each example
      • cacheMemory

        public LayerMemoryReport.Builder cacheMemory​(Map<CacheMode,​Long> cacheModeMemoryFixed,
                                                     Map<CacheMode,​Long> cacheModeMemoryVariablePerEx)
        Reports the cached/cacheable memory requirements.
        Parameters:
        cacheModeMemoryFixed - Number of elements of cache memory, independent of the mini batch size
        cacheModeMemoryVariablePerEx - Number of elements of cache memory, for each example