示例#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 INDArray outerProduct(INDArray a) {
   int n = sliceCount();
   ArrayList<INDArray> al = new ArrayList<INDArray>(n);
   for (INDArray s : this) {
     al.add(s.outerProduct(a));
   }
   return Arrayz.create(al);
 }
示例#3
0
 @Override
 public INDArray reshape(int... dimensions) {
   return Arrayz.createFromVector(asVector(), dimensions);
 }