Class FunctionSequence<T extends Tensor<T>,​F extends Function<T>>

java.lang.Object
deepboof.graph.FunctionSequence<T,​F>

public class FunctionSequence<T extends Tensor<T>,​F extends Function<T>>
extends java.lang.Object
Processes a sequence of forward functions. Any non-cyclical graph with a single input and a single output can be processed by this function. The list of functions passed in to the constructor is assumed to have already been ordered.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected TensorFactory<T> factory  
    protected java.util.Map<java.lang.String,​Node<T,​F>> lookup  
    protected java.util.Map<java.lang.String,​org.ddogleg.struct.Tuple2<T,​T>> outputStorage  
    protected java.util.List<Node<T,​F>> sequence  
  • Constructor Summary

    Constructors 
    Constructor Description
    FunctionSequence​(java.util.List<Node<T,​F>> sequence, java.lang.Class<T> type)
    Configures the sequence
  • Method Summary

    Modifier and Type Method Description
    T getNodeOutput​(int index)  
    int[] getOutputShape()  
    java.util.List<Node<T,​F>> getSequence()  
    java.lang.Class<T> getTensorType()  
    void initialize​(int[] inputShape)
    Initialize and declare memory for all nodes in the network given the shape of the input tensor
    void process​(T input, T output)
    Process the input tensor and compute the output tensor by feeding the results through the network.
    void setParameters​(java.util.Map<java.lang.String,​java.util.List<T>> nodeParameters)
    Specify the parameters for each node in the network

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • FunctionSequence

      public FunctionSequence​(java.util.List<Node<T,​F>> sequence, java.lang.Class<T> type)
      Configures the sequence
      Parameters:
      sequence - Sequence of functions which has been ordered to meet pre-requisites.
      type - Type of tensor
  • Method Details

    • initialize

      public void initialize​(int[] inputShape)
      Initialize and declare memory for all nodes in the network given the shape of the input tensor
      Parameters:
      inputShape - Shape of input tensor.
    • setParameters

      public void setParameters​(java.util.Map<java.lang.String,​java.util.List<T>> nodeParameters)
      Specify the parameters for each node in the network
      Parameters:
      nodeParameters - Map where the key is the function/node name and the value is the parameters for that node
    • process

      public void process​(T input, T output)
      Process the input tensor and compute the output tensor by feeding the results through the network. Must call initialize(int[]) once with the same shape as the input tensor. Must also call setParameters(java.util.Map<java.lang.String, java.util.List<T>>)
      Parameters:
      input - Input tensor
      output - Storage for output tensor.
    • getSequence

      public java.util.List<Node<T,​F>> getSequence()
    • getNodeOutput

      public T getNodeOutput​(int index)
    • getOutputShape

      public int[] getOutputShape()
    • getTensorType

      public java.lang.Class<T> getTensorType()