Example #1
0
  /**
   * Used to manually input data into a {@link Network}, the other way being the call to {@link
   * Network#start()} for a Network that contains a Region that contains a {@link Layer} which in
   * turn contains a {@link Sensor} <em>-OR-</em> subscribing a receiving Region to this Region's
   * output Observable.
   *
   * @param input One of (int[], String[], {@link ManualInput}, or Map&lt;String, Object&gt;)
   */
  public <T> void compute(T input) {
    if (tail == null && regions.size() == 1) {
      this.tail = regions.get(0);
    }

    if (head == null) {
      addDummySubscriber();
    }

    tail.compute(input);
  }
Example #2
0
  /**
   * Used to manually input data into a {@link Network} in a synchronous way, the other way being
   * the call to {@link Network#start()} for a Network that contains a Region that contains a {@link
   * Layer} which in turn contains a {@link Sensor} <em>-OR-</em> subscribing a receiving Region to
   * this Region's output Observable.
   *
   * @param input One of (int[], String[], {@link ManualInput}, or Map&lt;String, Object&gt;)
   */
  public <T> Inference computeImmediate(T input) {
    if (tail == null && regions.size() == 1) {
      this.tail = regions.get(0);
    }

    if (head == null) {
      addDummySubscriber();
    }

    tail.compute(input);
    return head.getHead().getInference();
  }