/[marvin]/marvin/src/libnn/propagate/propagateTdnnVisitor.ml
ViewVC logotype

Diff of /marvin/src/libnn/propagate/propagateTdnnVisitor.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by matthieu, Wed Sep 10 18:02:33 2003 UTC revision 1.5 by matthieu, Wed Sep 10 21:20:10 2003 UTC
# Line 54  object Line 54  object
54    inherit [tdNN] propagateVisitor    inherit [tdNN] propagateVisitor
55    val mutable _transfertFunction = function x -> (1. /. (1. +. exp (-.x)))    val mutable _transfertFunction = function x -> (1. /. (1. +. exp (-.x)))
56    method visit (network : tdNN) =    method visit (network : tdNN) =
57      let step = network#getStep and      let transFun = _transfertFunction and
58      transFun = _transfertFunction and          outputActivation = network#getOutputActivation and
59      outputActivation = network#getOutputActivation and          inputSum = network#getInputSum and
60      inputSum = network#getInputSum and          weights = network#getWeights and
61      weights = network#getWeights and          delay = network#getDelay and
62      delay = network#getDelay and          timeNb = network#getTimeNb and
63      stepDelay = ref 0 in          featuresNb = network#getFeaturesNb and
64        begin          stepDelay = ref 0 in
65          (**      begin
66            Activation of the input layer.        (**
67          *)           Activation of the input layer.
68          for i = 0 to (network#getFeaturesNb 0) - 1 do         *)
69            for j = 0 to (network#getTimeNb 0) - 1 do        for i = 0 to featuresNb.(0) - 1 do
70              !outputActivation.(0).(i).(j) <- transFun !inputSum.(0).(i).(j)          for j = 0 to timeNb.(0) - 1 do
71            done            !outputActivation.(0).(i).(j) <- transFun !inputSum.(0).(i).(j)
72          done;          done
73          (**        done;
74            Propagation of the activation.        (**
75            l the layer           Propagation of the activation.
76            i neuron of the layer l + 1 in the feature direction           l the layer
77            j neuron of the layer l + 1 in the time direction           i neuron of the layer l + 1 in the feature direction
78            k neuron of the layer l in the feature direction           j neuron of the layer l + 1 in the time direction
79            m neuron of the layer l in the time direction           k neuron of the layer l in the feature direction
80            stepDelay used to keep the delay concept           m neuron of the layer l in the time direction
81             stepDelay used to keep the delay concept
82          *)          *)
83          for l = 0 to network#getLayerNb - 2 do        for l = 0 to network#getLayerNb - 2 do
84            for i = 0 to (network#getFeaturesNb (l + 1)) - 1 do          for i = 0 to featuresNb.(l + 1) - 1 do
85              for j = 0 to (network#getTimeNb (l + 1)) - 1 do            for j = 0 to timeNb.(l + 1) - 1 do
86                !inputSum.(l + 1).(i).(j) <- 0.;              !inputSum.(l + 1).(i).(j) <- 0.;
87                for k = 0 to (network#getFeaturesNb l) - 1 do              for k = 0 to featuresNb.(l) - 1 do
88                  for m = !stepDelay to (!stepDelay + !delay.(l)) - 1 do                for m = !stepDelay to (!stepDelay + !delay.(l)) - 1 do
89                    !inputSum.(l + 1).(i).(j) <- !inputSum.(l + 1).(i).(j)                  !inputSum.(l + 1).(i).(j) <- !inputSum.(l + 1).(i).(j)
90                    +. !outputActivation.(l).(k).(l + !stepDelay)                      +. !outputActivation.(l).(k).(l + !stepDelay)
91                    *. !weights.(l).(i).(k).(j);                      *. !weights.(l).(i).(k).(j);
92                  done                done
93                done;                done;
94                !outputActivation.(l + 1).(i).(j) <- transFun !inputSum.(l + 1).(i).(j);              !outputActivation.(l + 1).(i).(j) <- transFun !inputSum.(l + 1).(i).(j);
95                stepDelay := !stepDelay + !delay.(l)              stepDelay := !stepDelay + !delay.(l)
             done;  
             stepDelay := 0  
96            done;            done;
97            stepDelay := 0            stepDelay := 0
98          done          done;
99            stepDelay := 0
100          done
101        end        end
102  end  end

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26