# Programmer's Guide: Flow of Control

Because Lens uses so many function pointers, it can be a bit confusing to trace the flow of control, or the order in which functions call one-another, within act.c and train.c. This page outlines the hierarchy in which functions are called during training and testing. Function pointers are contain arrows (->). "N->" indicates a function pointer that is part of the network structure. "S->" is a function pointer in the example set structure. Names in parentheses are the default functions to which the corresponding function pointer points. All functions are not shown, just the most important ones.

### Training Standard Networks

    C_train
      N->netTrain (standardNetTrain)
        N->netTrainBatch (standardNetTrainBatch)
          loadNextExample
            S->nextExample (orderedLoadNextExample)
              S->loadExample (standardLoadExample)
          N->netTrainExample (standardNetRunExample)
            S->loadEvent (standardLoadEvent)
            N->netTrainTick (netForwardBackward)
              computeInput
              computeOutput
              computeCost

### Testing Standard Networks

    C_test
      N->netTestBatch (standardNetTestBatch)
        loadNextExample
          S->nextExample (orderedLoadNextExample)
            S->loadExample (standardLoadExample)
        N->netTestExample (standardNetRunExample)
          S->loadEvent (standardLoadEvent)
          N->netTestTick (netForward)
            computeInput
            computeOutput
            computeCost
            computeCostBack
            computeOutputBack
            computeInputBack

### Training Continuous Networks

    C_train
      N->netTrain (standardNetTrain)
        N->netTrainBatch (standardNetTrainBatch)
          loadNextExample
            S->nextExample (orderedLoadNextExample)
              S->loadExample (standardLoadExample)
          N->netTrainExample (standardNetRunExample)
            S->loadEvent (standardLoadEvent)
            N->netTrainTick (continuousNetTrainTickForward)
              continuousNetTickForward
                computeInput
                computeOutput
                computeCost
              computeCostBack
          N->netTrainExampleBack (continuousNetExampleBack)
            computeOutputBack
            computeInputBack

### Testing Continuous Networks

    C_test
      N->netTestBatch (standardNetTestBatch)
        loadNextExample
          S->nextExample (orderedLoadNextExample)
            S->loadExample (standardLoadExample)
        N->netTestExample (standardNetRunExample)
          S->loadEvent (standardLoadEvent)
          N->netTestTick (continuousNetTickForward)
            computeInput
            computeOutput
            computeCost

### Training Boltzmann Machines

    C_train
      N->netTrain (standardNetTrain)
        N->netTrainBatch (standardNetTrainBatch)
          loadNextExample
            S->nextExample (orderedLoadNextExample)
              S->loadExample (standardLoadExample)
          N->netTrainExample (boltzmannNetTrainExample)
            S->loadEvent (standardLoadEvent)
            N->netTrainTick (boltzmannUpdate)
              computeInput
              computeOutput
            initializeBoltzmannOutputs
            resetBoltzmannOutputs
            boltzmannSettled
            computeCost
            computeInputBack

### Testing Boltzmann Machines

    C_test
      N->netTestBatch (standardNetTestBatch)
        loadNextExample
          S->nextExample (orderedLoadNextExample)
            S->loadExample (standardLoadExample)
        N->netTestExample (boltzmannNetTestExample)
          S->loadEvent (standardLoadEvent)
          N->netTestTick (boltzmannUpdate)
            computeInput
            computeOutput
          initializeBoltzmannOutputs
          resetBoltzmannOutputs
          boltzmannSettled

Last modified: Mon Nov 13 13:57:53 EST 2000