00001 /******************************************************************************** 00002 * Neural Network Framework. * 00003 * Copyright (C) 2005-2008 Gianluca Massera <emmegian@yahoo.it> * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the Free Software * 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 00018 ********************************************************************************/ 00019 00020 #ifndef OUTPUTFUNCTION_H 00021 #define OUTPUTFUNCTION_H 00022 00028 #include "types.h" 00029 #include "clonable.h" 00030 #include "propertized.h" 00031 00032 00033 namespace nnfw { 00034 00039 class NNFW_API OutputFunction : public Propertized { 00040 public: 00044 OutputFunction(); 00045 00047 virtual ~OutputFunction(); 00048 00050 00052 00055 virtual void apply( RealVec& inputs, RealVec& outputs ); 00056 00059 Real apply( Real input ) { 00060 tmp1[0] = input; 00061 apply( tmp1, tmp2 ); 00062 return tmp2[0]; 00063 }; 00064 00072 virtual void setCluster( Cluster* ) { /* nothing to do */ }; 00073 00075 virtual OutputFunction* clone() const; 00076 00078 00079 private: 00081 RealVec tmp1; 00083 RealVec tmp2; 00084 }; 00085 00086 } 00087 00088 #endif