Пример #1
0
  @Override
  public INDArray innerProduct(INDArray a) {
    int dims = dimensionality();
    switch (dims) {
      case 0:
        {
          a = a.clone();
          a.scale(get());
          return a;
        }
      case 1:
        {
          return this.toVector().innerProduct(a);
        }
      case 2:
        {
          return Matrix.create(this).innerProduct(a);
        }
    }

    int n = sliceCount();
    ArrayList<INDArray> al = new ArrayList<INDArray>(n);
    for (INDArray s : this) {
      al.add(s.innerProduct(a));
    }
    return Arrayz.create(al);
  }
Пример #2
0
 @Override
 public void multiply(double d) {
   for (INDArray a : slices) {
     a.scale(d);
   }
 }