43 |
@since 10/08/2003 |
@since 10/08/2003 |
44 |
*) |
*) |
45 |
|
|
|
(** |
|
|
Needed for random number generation. |
|
|
*) |
|
|
open Random |
|
|
|
|
46 |
open Nn |
open Nn |
47 |
open InputVisitor |
open InputVisitor |
48 |
open DefaultVisitor |
open DefaultVisitor |
52 |
object |
object |
53 |
inherit [tdNN] inputVisitor |
inherit [tdNN] inputVisitor |
54 |
|
|
55 |
|
initializer |
56 |
|
_moduleName <- "TDNN input layer activation" |
57 |
|
|
58 |
(** |
(** |
59 |
The method which activate the input layer. |
The method which activate the input layer. |
60 |
The activation of the Tdnn can be done with several methods : |
The activation of the Tdnn can be done with several methods : |
71 |
let inputSum = network#getInputSum and |
let inputSum = network#getInputSum and |
72 |
inputLearnVector = network#getInputLearnVector in |
inputLearnVector = network#getInputLearnVector in |
73 |
match (!inputSum, inputLearnVector) with |
match (!inputSum, inputLearnVector) with |
74 |
(a, b) when (Array.length a.(0) * Array.length a.(0).(0)) != Array.length inputLearnVector |
(a, b) when |
75 |
-> (Env.getEnv())#toChannel "Class inputTdnnVisitor : The inputSum and the inputLearnVector haven't the same size, I stop here.\n" |
(Array.length a.(0) * Array.length a.(0).(0)) != |
76 |
|
Array.length inputLearnVector |
77 |
|
-> (Env.getEnv())#err "tdnn/input" |
78 |
|
"inputSum and inputLearnVector don't have the same size. skipping task." 1 |
79 |
| _ -> |
| _ -> |
80 |
begin |
begin |
81 |
for i = 0 to network#getLayerNb - 1 do |
for i = 0 to network#getLayerNb - 1 do |
82 |
for j = 0 to (network#getFeaturesNb i) - 1 do |
for j = 0 to (network#getFeaturesNb.(i)) - 1 do |
83 |
for k = 0 to (network#getTimeNb i) - 1 do |
for k = 0 to (network#getTimeNb.(i)) - 1 do |
84 |
!inputSum.(i).(j).(k) <- inputLearnVector.(i + j + k) |
!inputSum.(i).(j).(k) <- inputLearnVector.(i + j + k) |
85 |
done |
done |
86 |
done |
done |
87 |
done |
done |
88 |
end |
end |
89 |
|
|
90 |
end |
end |