예제 #1
0
 /**
  * @return bool
  * @throws \Exception
  */
 public function send()
 {
     //Choose @var int $_directionType
     $_directionType = Net::getDirection() == Net::DIRECT ? Relation::SIGNAL : Relation::MISTAKE;
     if (!isset($this->_relations[$_directionType]) || !is_array($this->_relations[$_directionType])) {
         if (Net::isTeacherMode()) {
             throw new \Exception("Cannot find direction: {$_directionType}");
         } else {
             return false;
             //Production Mode shouldn`t have reverse direction
         }
     }
     /** @var Relation $relation */
     foreach ($this->_relations[$_directionType] as $relation) {
         $relation->send($this);
         //Sending from current neuron
     }
     $this->flushSignals();
     return true;
 }