亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? node.h

?? The library is a C++/Python implementation of the variational building block framework introduced in
?? H
?? 第 1 頁 / 共 3 頁
字號:
// -*- C++ -*-//// This file is a part of the Bayes Blocks library//// Copyright (C) 2001-2006 Markus Harva, Antti Honkela, Alexander// Ilin, Tapani Raiko, Harri Valpola and Tomas 謘tman.//// 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, 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 (included in file License.txt in the// program package) for more details.//// $Id: Node.h 7 2006-10-26 10:26:41Z ah $#ifndef NODE_H#define NODE_H#include <string>#include <map>#include "Templates.h"#include "Saver.h"#include "Loader.h"#include "Decay.h"#include "Net.h"class Node;#ifndef BUILDING_SWIG_INTERFACEtypedef bool BOOLASOBJ;#endifenum partype_e {  REAL_MV, REAL_ME, REAL_M, REALV_MV, REALV_ME, REALV_M, DISCRETE,  DISCRETEV};class NodeBase{public:  virtual ~NodeBase() { }  virtual int ParIdentity(const Node *ptr) = 0;  virtual size_t NumParents() = 0;  virtual Node *GetParent(size_t i) = 0;  virtual int RemoveParent(const Node *ptr) = 0;protected:  virtual void ReallyAddParent(Node *ptr) = 0;  virtual bool ParReplacePtr(const Node *oldptr, Node *newptr) = 0;};class Node : public virtual NodeBase{public:  friend Net::Net(NetLoader *loader);  virtual ~Node() { }  void NotifyDeath(Node *ptr, int verbose = 0);  virtual void NotifyTimeType(int tt, int verbose = 0);  void ReplacePtr(Node *oldptr, Node *newptr);  void AddChild(Node *ptr) {children.push_back(ptr);}protected:  Node(Net *ptr, Label label);#ifndef BUILDING_SWIG_INTERFACE  Node(Net *ptr, NetLoader *loader, bool isproxy = 0);#endif  void AddParent(Node *ptr, bool really=true);public:  virtual bool GetReal(DSSet &val, DFlags req) { return false; }  virtual void GradReal(DSSet &val, const Node *ptr) {}  virtual bool GetRealV(DVH &val, DFlags req) {    val.vec = 0; return GetReal(val.scalar, req); }  virtual void GradRealV(DVSet &val, const Node *ptr) {}#ifdef BUILDING_SWIG_INTERFACE  virtual BOOLASOBJ GetDiscrete(DD *&val) { return false; }#else  virtual bool GetDiscrete(DD *&val) { return false; }#endif  virtual void GradDiscrete(DD &val, const Node *ptr) {}  virtual bool GetDiscreteV(VDDH &val) {    val.vec = 0; return GetDiscrete(val.scalar); }  virtual void GradDiscreteV(VDD &val, const Node *ptr) {}  virtual void Outdate(const Node *ptr) { OutdateChild(); }  void CheckParent(size_t parnum, partype_e partype);  bool ParReal(int i, DSSet &val, const DFlags req) {    return GetParent(i)->GetReal(val, req);}  bool ParRealV(int i, DVH &val, const DFlags req) {    return GetParent(i)->GetRealV(val, req);}  bool ParDiscrete(int i, DD *&val) {    return GetParent(i)->GetDiscrete(val);}  bool ParDiscreteV(int i, VDDH &val) {    return GetParent(i)->GetDiscreteV(val);}  void ChildGradReal(DSSet &val);  void ChildGradRealV(DVSet &val);  void ChildGradDiscrete(DD &val);  void ChildGradDiscreteV(VDD &val);  Label GetLabel() const { return label; }  string GetIdent() const { return GetType() + " node " + GetLabel(); }  Net *GetNet() const { return net; }  virtual string GetType() const = 0;  int TimeType() { return timetype; }  int GetDying() { return dying; }  void Die(int verbose = 0);  void OutdateChild();  virtual void Save(NetSaver *saver);  size_t NumChildren() { return children.size(); }  Node *GetChild(size_t i) {return i < children.size() ? children[i] : 0;}  int GetPersist() { return persist; }  void SetPersist(int p) { persist = p; }protected:  vector<Node *> children;  Net *net;  Label label;  int persist, timetype;  bool dying;};class NullParNode : public virtual NodeBase{public:  virtual int ParIdentity(const Node *ptr) {return -1;}  virtual size_t NumParents() { return 0; }  virtual Node *GetParent(size_t i) {return 0;}  virtual int RemoveParent(const Node *ptr) {return 0;}protected:  virtual void ReallyAddParent(Node *ptr) {return;}  virtual bool ParReplacePtr(const Node *oldptr, Node *newptr) {return false;}};class UniParNode : public virtual NodeBase{private:  Node *parent;public:  UniParNode(Node *p) : parent(p) {}  virtual int ParIdentity(const Node *ptr) { return ptr==parent ? 0 : -1;}  virtual size_t NumParents() { return parent!=0; }  virtual Node *GetParent(size_t i) {return i==0 ? parent : 0;}  virtual int RemoveParent(const Node *ptr);protected:  virtual void ReallyAddParent(Node *ptr) { parent = ptr; }  virtual bool ParReplacePtr(const Node *oldptr, Node *newptr) {    return (parent==oldptr) ? (parent=newptr) : false; }};class BiParNode : public virtual NodeBase{private:  Node *parents[2];public:  BiParNode(Node *p1, Node *p2) { parents[0]=p1; parents[1]=p2; }  virtual int ParIdentity(const Node *ptr);  virtual size_t NumParents() { return parents[0] == 0 ? 0 :      (parents[1] == 0 ? 1 : 2); }  virtual Node *GetParent(size_t i) {return i < 2 ? parents[i] : 0;}  virtual int RemoveParent(const Node *ptr);protected:  virtual void ReallyAddParent(Node *ptr);  virtual bool ParReplacePtr(const Node *oldptr, Node *newptr);};class NParNode : public virtual NodeBase{private:  vector<Node *> parents;  map<const Node *, int> parent_inds;public:  NParNode(Node *p1=0, Node *p2=0, Node *p3=0, Node *p4=0, Node *p5=0) {    if (p1) parents.push_back(p1);    if (p2) parents.push_back(p2);    if (p3) parents.push_back(p3);    if (p4) parents.push_back(p4);    if (p5) parents.push_back(p5);  }  virtual int ParIdentity(const Node *ptr);  virtual size_t NumParents() { return parents.size(); }  virtual Node *GetParent(size_t i) {return i < parents.size() ? parents[i] : 0;}  virtual int RemoveParent(const Node *ptr);protected:  virtual void ReallyAddParent(Node *ptr) { parents.push_back(ptr); }  virtual bool ParReplacePtr(const Node *oldptr, Node *newptr);};class Constant : public Node, public NullParNode{public:  Constant(Net *net, Label label, double v) : Node(net, label) {cval = v;}#ifndef BUILDING_SWIG_INTERFACE  Constant(Net *net, NetLoader *loader);#endif  void NotifyTimeType(int tt, int verbose=0) {}  bool GetReal(DSSet &val, DFlags req) {    if (req.mean) {val.mean = cval; req.mean = false;}    if (req.var) {val.var = 0; req.var = false;}    if (req.ex) {val.ex = exp(cval); req.ex = false;}    return req.AllFalse();  }  void GradReal(DSSet &val, const Node *ptr) {}  void Save(NetSaver *saver);  string GetType() const { return "Constant"; }private:  double cval;};class ConstantV : public Node, public NullParNode{public:  ConstantV(Net *net, Label label, DV v);#ifndef BUILDING_SWIG_INTERFACE  ConstantV(Net *net, NetLoader *loader);#endif  void NotifyTimeType(int tt, int verbose=0) {}  bool GetRealV(DVH &val, DFlags req) {    val.vec = &myval;    req.mean = false;    req.var = false;    req.ex = false;    return req.AllFalse();  }  void Save(NetSaver *saver);  string GetType() const { return "ConstantV"; }private:  DVSet myval;};class Function : public Node{public:  void Outdate(const Node *ptr)   {    uptodate = DFlags(false,false,false);     OutdateChild();  }  virtual void Save(NetSaver *saver);protected:  Function(Net *ptr, Label label, Node *n1 = 0, Node *n2 = 0);#ifndef BUILDING_SWIG_INTERFACE  Function(Net *ptr, NetLoader *loader);#endif  DFlags uptodate;};class Prod : public Function, public BiParNode{public:  Prod(Net *ptr, Label label, Node *n1, Node *n2) :    Function(ptr, label, n1, n2), BiParNode(n1, n2) {mean = 0.0; var = 0.0;}#ifndef BUILDING_SWIG_INTERFACE  Prod(Net *ptr, NetLoader *loader);#endif  bool GetReal(DSSet &val, DFlags req);  void GradReal(DSSet &val, const Node *ptr);  void Save(NetSaver *saver);  string GetType() const { return "Prod"; }private:  double mean, var;};class Sum2 : public Function, public BiParNode{public:  Sum2(Net *ptr, Label label, Node *n1, Node *n2) :     Function(ptr, label, n1, n2), BiParNode(n1, n2) {    persist = 4 | 8; // Sum2 needs at least one child and cuts off if                     // there is only one parent  }#ifndef BUILDING_SWIG_INTERFACE  Sum2(Net *ptr, NetLoader *loader);#endif  bool GetReal(DSSet &val, DFlags req);  void GradReal(DSSet &val, const Node *ptr);  void Save(NetSaver *saver);  string GetType() const { return "Sum2"; }private:  DSSet myval;};class SumN : public Function, public NParNode{public:  SumN(Net *net, Label label) :     Function(net, label)  {    persist = 4 | 8; // SumN needs at least one child and cuts off if                     // there is only one parent    keepupdated = false;  }#ifndef BUILDING_SWIG_INTERFACE  SumN(Net *net, NetLoader *loader);#endif  bool AddParent(Node *n);  bool GetReal(DSSet &val, DFlags req);  void GradReal(DSSet &val, const Node *ptr);  void Save(NetSaver *saver);  string GetType() const { return "SumN"; }  void Outdate(const Node *ptr);  void SetKeepUpdated(const bool _keepupdated);private:  DSSet myval;  vector<DSSet> parentval;  bool keepupdated;};class Relay : public Function, public UniParNode{public:  Relay(Net *ptr, Label label, Node *n) :    Function(ptr, label, n), UniParNode(n) {}#ifndef BUILDING_SWIG_INTERFACE  Relay(Net *ptr, NetLoader *loader);#endif  bool GetReal(DSSet &val, DFlags req) {return ParReal(0, val, req);}  void GradReal(DSSet &val, const Node *ptr) {ChildGradReal(val);}  void Save(NetSaver *saver);  string GetType() const { return "Relay"; }};class Variable : public Node{public:  virtual double Cost() = 0;  virtual void Update() {    if (!clamped) {       MyUpdate();       OutdateChild();    }  }  virtual void PartialUpdate(IntV *indices) {    if (!clamped) {      MyPartialUpdate(indices);      OutdateChild();    }  }  void Clamp(double val)  {    if (!MyClamp(val)) {      ostringstream msg;      msg << GetIdent() << ": Double clamp not allowed";      throw TypeException(msg.str());    }    clamped = true; costuptodate = false;    OutdateChild();  }  void Clamp(double mean, double var)  {    if (!MyClamp(mean, var)) {      ostringstream msg;      msg << GetIdent() << ": Double double clamp not allowed";      throw TypeException(msg.str());    }    clamped = true; costuptodate = false;    OutdateChild();  }  void Clamp(const DV &val)  {    if (!MyClamp(val)) {      ostringstream msg;      msg << GetIdent() << ": DV clamp not allowed";      throw TypeException(msg.str());    }    clamped = true; costuptodate = false;    OutdateChild();  }  void Clamp(const DV &mean, const DV &var)  {    if (!MyClamp(mean, var)) {      ostringstream msg;      msg << GetIdent() << ": Double DV clamp not allowed";      throw TypeException(msg.str());    }    clamped = true; costuptodate = false;    OutdateChild();  }  void Clamp(const DD &val) {    if (!MyClamp(val)) {      ostringstream msg;      msg << GetIdent() << ": DD clamp not allowed";      throw TypeException(msg.str());    }    clamped = true; costuptodate = false;    OutdateChild();  }  void Clamp(int val) {    if (!MyClamp(val)) {      ostringstream msg;      msg << GetIdent() << ": Int clamp not allowed";      throw TypeException(msg.str());    }    clamped = true; costuptodate = false;    OutdateChild();  }  void Clamp(const VDD &val) {    if (!MyClamp(val)) {      ostringstream msg;      msg << GetIdent() << ": VDD clamp not allowed";      throw TypeException(msg.str());    }    clamped = true; costuptodate = false;    OutdateChild();  }  void Unclamp() {if (clamped) {clamped = false; MyUpdate(); OutdateChild();}}  void SaveState();  void SaveStep();  void RepeatStep(double alpha);  void SaveRepeatedState(double alpha);  void ClearStateAndStep();  virtual void Outdate(const Node *ptr) {costuptodate = false;}  virtual void Save(NetSaver *saver);  int GetHookeFlags() { return hookeflags; }  void SetHookeFlags(int h) { hookeflags = h; }  bool IsClamped() { return clamped; }  // These two methods are ment for copying things from one network  // to another similar one  // The allocation of the DV instance is left to user  // so it can be done in the jurisdiction of Python's GC.  // The DV is resized, so initially it can be of size zero, for example.  virtual void GetState(DV *state, size_t t = 0) {    ostringstream msg;    msg << "GetState not supported by " << GetType();    throw TypeException(msg.str());  }  virtual void SetState(DV *state, size_t t = 0) {    ostringstream msg;    msg << "SetState not supported by " << GetType();    throw TypeException(msg.str());  }protected:  Variable(Net *ptr, Label label, Node *n1 = 0, Node *n2 = 0);#ifndef BUILDING_SWIG_INTERFACE  Variable(Net *ptr, NetLoader *loader);#endif  virtual bool MyClamp(double val) {return false;}  virtual bool MyClamp(double mean, double var) {return false;}  virtual bool MyClamp(const DV &val) {return false;}  virtual bool MyClamp(const DV &mean, const DV &var) {return false;}  virtual bool MyClamp(const DD &val) {return false;}  virtual bool MyClamp(int val) {return false;}  virtual bool MyClamp(const VDD &val) {return false;}  virtual void MyUpdate() = 0;  virtual bool MySaveState() {return false;}  virtual bool MySaveStep() {return false;}  virtual bool MySaveRepeatedState(double alpha) {return false;}  virtual void MyRepeatStep(double alpha) {}  virtual bool MyClearStateAndStep() {return false; }  virtual void MyPartialUpdate(IntV *indices) {    ostringstream msg;    msg << "Partial updates not supported by " << GetType();    throw StructureException(msg.str());  }      bool clamped, costuptodate;  int hookeflags;};class Gaussian : public Variable, public BiParNode{public:  Gaussian(Net *net, Label label, Node *m, Node *v);#ifndef BUILDING_SWIG_INTERFACE  Gaussian(Net *net, NetLoader *loader);#endif  ~Gaussian() {    if (sstate) delete sstate;    if (sstep) delete sstep;  }  double Cost();  bool GetReal(DSSet &val, DFlags req);  void GradReal(DSSet &val, const Node *ptr);  void Save(NetSaver *saver);  string GetType() const { return "Gaussian"; }  void GetState(DV *state, size_t t);  void SetState(DV *state, size_t t);protected:  virtual bool MyClamp(double m);  virtual bool MyClamp(double m, double v);  virtual void MyUpdate();  bool MySaveState();  bool MySaveStep();  bool MySaveRepeatedState(double alpha);  void MyRepeatStep(double alpha);  bool MyClearStateAndStep();  void MyPartialUpdate(IntV *indices);  DSSet myval;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品亚洲porn| 日韩一区二区三区在线视频| 青青草97国产精品免费观看无弹窗版| 中文字幕国产一区二区| 日韩小视频在线观看专区| 国产精品三级av在线播放| 中文av字幕一区| 麻豆精品久久久| 国产高清亚洲一区| 成人av在线播放网站| www.欧美精品一二区| 91视频免费看| 欧美久久一二区| 精品日韩一区二区| 国产日韩欧美a| 亚洲精选免费视频| 丝袜亚洲另类欧美| 精品无人码麻豆乱码1区2区 | 久久亚洲一级片| 久久久亚洲精品石原莉奈| 国产欧美日韩三级| 国产麻豆精品在线| 欧美二区三区91| 亚洲精品免费一二三区| 成人av免费在线| 国产精品毛片大码女人 | 亚洲国产成人av| 亚洲电影第三页| 久久国产精品一区二区| 不卡欧美aaaaa| 国产欧美一区二区精品婷婷| 国产真实乱偷精品视频免| av中文字幕不卡| 国产精品美女久久久久久久久久久| 国产乱码精品一区二区三| 色先锋资源久久综合| 欧美一区二区三区日韩视频| 国产精品久久久久久久久免费相片 | 午夜久久久久久电影| 国产一区高清在线| 久久亚洲精品小早川怜子| 极品瑜伽女神91| 国产欧美日韩中文久久| 成+人+亚洲+综合天堂| 亚洲欧美二区三区| 国产专区综合网| 国产日韩欧美制服另类| a级高清视频欧美日韩| 亚洲欧美日韩国产手机在线| 欧洲av在线精品| 欧美精彩视频一区二区三区| aaa国产一区| 亚洲久草在线视频| 欧美一三区三区四区免费在线看 | 欧美a级一区二区| 精品国产91九色蝌蚪| 亚洲国产欧美日韩另类综合 | 成人黄色小视频| 亚洲制服丝袜在线| av高清久久久| 亚洲一二三区在线观看| 日韩欧美另类在线| 午夜av一区二区| 久久久综合精品| 91国模大尺度私拍在线视频| 中文字幕成人网| 欧美日韩一区中文字幕| 一区二区三区精品久久久| 成人免费视频app| 国产视频一区在线观看| 国产乱码精品1区2区3区| 亚洲色图欧洲色图婷婷| 色综合久久久久综合体桃花网| 午夜伦欧美伦电影理论片| 久久精品无码一区二区三区| 欧美视频在线一区二区三区| 亚洲成人黄色小说| 日本一区二区三级电影在线观看 | 91精品国产91久久综合桃花 | 欧美国产精品劲爆| 欧美日韩大陆一区二区| 亚洲国产精品久久久男人的天堂| 精品少妇一区二区三区| 欧美亚洲国产怡红院影院| 国产经典欧美精品| 日韩av在线免费观看不卡| 欧美一区二区网站| 91视频国产资源| 高清不卡一二三区| 亚洲欧美综合网| 一本大道av伊人久久综合| 精品一区二区三区香蕉蜜桃| 一区二区免费视频| 中文字幕一区二区三区av| 欧美精品一区视频| 日韩一二在线观看| 欧美日韩在线播放三区四区| 91丨porny丨在线| 成人激情动漫在线观看| 国产成人在线影院| 国产一区在线精品| 久久爱www久久做| 人妖欧美一区二区| 日韩精品一卡二卡三卡四卡无卡| 亚洲欧美日韩综合aⅴ视频| 国产精品美女视频| 日本一区二区不卡视频| 久久人人爽爽爽人久久久| 日韩一区二区在线看片| 91麻豆精品国产91久久久更新时间| 久久国产夜色精品鲁鲁99| 视频一区在线播放| 视频一区视频二区中文| 亚洲成a人在线观看| 亚洲成精国产精品女| 天天综合色天天综合| 日韩精品欧美成人高清一区二区| 亚洲观看高清完整版在线观看 | 久久综合九色综合97婷婷女人| 欧美一区二区三区视频免费播放| 在线播放日韩导航| 制服.丝袜.亚洲.另类.中文| 欧美一区二区福利在线| 欧美tickle裸体挠脚心vk| 日韩色在线观看| 久久久亚洲精品石原莉奈| 国产日本欧洲亚洲| 亚洲视频一区二区在线| 又紧又大又爽精品一区二区| 亚洲一区在线观看视频| 日韩福利视频网| 国产做a爰片久久毛片| 成人晚上爱看视频| 在线观看视频91| 日韩欧美国产精品| 久久久久国产成人精品亚洲午夜| 日本一区二区免费在线观看视频 | 日韩高清不卡一区二区| 久久99久久99| 成人成人成人在线视频| 欧洲精品在线观看| 欧美xxxx在线观看| 国产精品电影一区二区| 五月天精品一区二区三区| 国产在线精品免费| 91小宝寻花一区二区三区| 欧美精品777| 国产女人水真多18毛片18精品视频| 亚洲天堂网中文字| 琪琪久久久久日韩精品| av不卡在线观看| 日韩午夜在线播放| 亚洲三级在线看| 久久激情综合网| 欧美在线免费播放| wwwwxxxxx欧美| 亚洲一区二区三区四区的| 精品一二三四区| 在线观看精品一区| 久久久蜜桃精品| 午夜视黄欧洲亚洲| 成人天堂资源www在线| 欧美一级夜夜爽| 亚洲欧美色图小说| 国产伦精品一区二区三区在线观看| 色综合久久精品| 国产欧美日韩精品一区| 日韩av二区在线播放| 色哟哟日韩精品| 欧美国产日韩a欧美在线观看 | 6080yy午夜一二三区久久| 国产精品女主播在线观看| 免费人成在线不卡| 色国产精品一区在线观看| 中文字幕欧美日本乱码一线二线| 日韩国产精品久久| 欧美在线色视频| 亚洲激情五月婷婷| 国产成人8x视频一区二区 | 中文字幕一区二区在线播放| 精品综合免费视频观看| 欧美日韩视频一区二区| 亚洲精品免费在线播放| av亚洲产国偷v产偷v自拍| 国产欧美一区二区三区网站| 精彩视频一区二区| 日韩欧美一区二区视频| 亚洲国产日产av| 欧美午夜一区二区三区免费大片| 日韩一区中文字幕| www.亚洲免费av| 国产精品久久精品日日| 成人一道本在线| 中文字幕第一区二区| 成人综合婷婷国产精品久久免费| 久久久精品免费观看| 韩国av一区二区三区四区 | 国产一二精品视频| 欧美r级在线观看| 国产一区二区看久久|