Build fix (IsMax) (#132)

Signed-off-by: AlexDBlack <blacka101@gmail.com>
master
Alex Black 2019-08-19 20:36:03 +10:00 committed by GitHub
parent b8ab1a00b0
commit 36db761917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -248,7 +248,7 @@ public class ValidateCuDNN extends BaseDL4JTest {
Nd4j.getRandom().setSeed(12345);
INDArray features = Nd4j.rand(fShape);
INDArray labels = Nd4j.rand(lShape);
Nd4j.getExecutioner().exec(new IsMax(labels, 1));
labels = Nd4j.exec(new IsMax(labels, 1));
List<CuDNNValidationUtil.TestCase> testCaseList = new ArrayList<>();
@ -256,7 +256,7 @@ public class ValidateCuDNN extends BaseDL4JTest {
for (int i = 0; i < 6; i++) {
INDArray f = Nd4j.rand(fShape);
INDArray l = Nd4j.rand(lShape);
Nd4j.getExecutioner().exec(new IsMax(l, 1));
Nd4j.exec(new IsMax(l, 1))[0];
dataSets.add(new DataSet(f, l));
}
DataSetIterator iter = new ExistingDataSetIterator(dataSets);

View File

@ -191,8 +191,8 @@ public class Yolo2OutputLayer extends AbstractLayer<org.deeplearning4j.nn.conf.l
//We also need 1_ij^noobj, which is (a) no object, or (b) object present in grid cell, but this box doesn't
// have the highest IOU
INDArray mask1_ij_obj = Nd4j.create(DataType.BOOL, iou.shape(), 'c');
Nd4j.getExecutioner().execAndReturn(new IsMax(iou, mask1_ij_obj, 1));
Nd4j.getExecutioner().execAndReturn(new BroadcastMulOp(mask1_ij_obj, maskObjectPresentBool, mask1_ij_obj, 0,2,3));
Nd4j.exec(new IsMax(iou, mask1_ij_obj, 1));
Nd4j.exec(new BroadcastMulOp(mask1_ij_obj, maskObjectPresentBool, mask1_ij_obj, 0,2,3));
INDArray mask1_ij_noobj = Transforms.not(mask1_ij_obj);
mask1_ij_obj = mask1_ij_obj.castTo(input.dataType());

View File

@ -296,7 +296,7 @@ public class GlobalPoolingLayer extends AbstractLayer<org.deeplearning4j.nn.conf
switch (poolingType) {
case MAX:
INDArray isMax = Nd4j.getExecutioner().exec(new IsMax(inputArray.dup(), poolDim));
INDArray isMax = Nd4j.exec(new IsMax(inputArray.dup(), poolDim))[0];
return Nd4j.getExecutioner().exec(new BroadcastMulOp(isMax, epsilon, isMax, broadcastDims));
case AVG:
//if out = avg(in,dims) then dL/dIn = 1/N * dL/dOut

View File

@ -136,7 +136,7 @@ public class MaskedReductionUtil {
Nd4j.getExecutioner().exec(new BroadcastAddOp(input, negInfMask, withInf, 0, 2));
//At this point: all the masked out steps have value -inf, hence can't be the output of the MAX op
INDArray isMax = Nd4j.getExecutioner().exec(new IsMax(withInf, 2));
INDArray isMax = Nd4j.exec(new IsMax(withInf, 2))[0];
return Nd4j.getExecutioner().exec(new BroadcastMulOp(isMax, epsilon2d, isMax, 0, 1));
case AVG:
@ -296,7 +296,7 @@ public class MaskedReductionUtil {
Nd4j.getExecutioner().exec(new BroadcastAddOp(input, negInfMask, withInf, dimensions));
//At this point: all the masked out steps have value -inf, hence can't be the output of the MAX op
INDArray isMax = Nd4j.getExecutioner().exec(new IsMax(withInf, 2, 3));
INDArray isMax = Nd4j.exec(new IsMax(withInf, 2, 3))[0];
return Nd4j.getExecutioner().exec(new BroadcastMulOp(isMax, epsilon2d, isMax, 0, 1));
case AVG: