(****************************************************************** [LibNN - Neural Networks Library] http://libnn.org Copyright (C) 2002 - 2003 LAGACHERIE Matthieu RICORDEAU Olivier This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. SPECIAL NOTE (the beerware clause): This software is free software. However, it also falls under the beerware special category. That is, if you find this software useful, or use it every day, or want to grant us for our modest contribution to the free software community, feel free to send us a beer from one of your local brewery. Our preference goes to Belgium abbey beers and irish stout (Guiness for strength!), but we like to try new stuffs. Authors: LAGACHERIE Matthieu Paper mail : 7 rue Delescluzes 94280 LE KREMLIN BICETRE, FRANCE E-mail : matthieu@libnn.org RICORDEAU Olivier Paper mail : 69 avenue d'Italie 75013 PARIS, FRANCE E-mail : olivier@libnn.org *****************************************************************) (** The inputTdnnVisitor class @author Matthieu Lagacherie @author Olivier Ricordeau @since 10/08/2003 *) (** Needed for random number generation. *) open Random open Nn open InputVisitor open DefaultVisitor open TdNN class inputTdnnVisitor = object inherit [tdNN] inputVisitor (** The method which activate the input layer. The activation of the Tdnn can be done with several methods : * ^ * ^ * ^ * ^ * / * / * / * / * / * / * / * / Here a tdnn with an input layer of 4 neurons on the temporal direction and 3 neurons on the feature drection. The signal (the kind of arrow --->) is initialized in a first time on the feature direction and in a second time on the temporal direction. *) method visit (network : tdNN) = let inputSum = network#getInputSum and inputLearnVector = network#getInputLearnVector in match (!inputSum, inputLearnVector) with (a, b) when (Array.length a.(0) * Array.length a.(0).(0)) != Array.length inputLearnVector -> (Env.getEnv())#toChannel "Class inputTdnnVisitor : The inputSum and the inputLearnVector haven't the same size, I stop here.\n" | _ -> begin for i = 0 to network#getLayerNb - 1 do for j = 0 to (network#getFeaturesNb i) - 1 do for k = 0 to (network#getTimeNb i) - 1 do !inputSum.(i).(j).(k) <- inputLearnVector.(i + j + k) done done done end end