Ejemplo n.º 1
0
 @Override
 protected void adaptSample(Sample original, Sample adapted) {
   adapted.input = original.input.copyInto(adapted.input);
   if (adapted.target == null) {
     adapted.target = new Tensor(labels.length);
   }
   adapted.target.fill(0.0f);
   for (int i = 0; i < labelIndices.length; i++) {
     adapted.target.set(original.target.get(labelIndices[i]), i);
   }
   if (other) {
     if (TensorOps.sum(adapted.target) == 0) {
       adapted.target.set(1.0f, labels.length - 1);
     }
   }
 }
Ejemplo n.º 2
0
 private char asChar(Tensor t) {
   int index = TensorOps.argmax(t);
   return chars.charAt(index);
 }