diff --git a/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/normalization/BatchNormalization.java b/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/normalization/BatchNormalization.java index 3fb2046c3..d5a4c75af 100644 --- a/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/normalization/BatchNormalization.java +++ b/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/normalization/BatchNormalization.java @@ -245,8 +245,8 @@ public class BatchNormalization extends BaseLayer backpropGradient(INDArray epsilon, LayerWorkspaceMgr workspaceMgr) { assertInputSet(true); - applyDropOutIfNecessary(true, workspaceMgr); //Edge case: we skip OutputLayer forward pass during training as this isn't required to calculate gradients if (input.rank() != 3) { throw new UnsupportedOperationException( "Input is not rank 3. RnnOutputLayer expects rank 3 input with shape [minibatch, layerInSize, sequenceLength]." + @@ -65,6 +64,8 @@ public class RnnOutputLayer extends BaseOutputLayer gradAndEpsilonNext = super.backpropGradient(epsilon, workspaceMgr); //Also applies dropout this.input = inputTemp; INDArray epsilon2d = gradAndEpsilonNext.getSecond(); diff --git a/libnd4j/include/ops/declarable/generic/parity_ops/batch_to_space_nd.cpp b/libnd4j/include/ops/declarable/generic/parity_ops/batch_to_space_nd.cpp index bc26e39ec..147944acc 100644 --- a/libnd4j/include/ops/declarable/generic/parity_ops/batch_to_space_nd.cpp +++ b/libnd4j/include/ops/declarable/generic/parity_ops/batch_to_space_nd.cpp @@ -61,12 +61,6 @@ CUSTOM_OP_IMPL(batch_to_space_nd, 3, 1, false, 0, 0) { const auto product = blockShape->reduceNumber(nd4j::reduce::Prod).e(0); REQUIRE_TRUE(input->sizeAt(0) % product == 0, 0, "BatchToSpaceND: first dimension of input array must be divisible by product of blockShape array elements (= %lld), but got first dimension equal to %i", product, input->sizeAt(0)); - // FIXME - should we use this time-consuming validation ? - for (uint i = 0; i < numOfSpatialDims; ++i) { - const Nd4jLong blockSize = blockShape->e(i); - REQUIRE_TRUE(blockSize >= 2, 0, "BatchToSpaceND: all elements of blockShape array must be >= 2, but got value of %i for element number %i !", blockSize, i); - } - if(crop->sizeAt(0) != numOfSpatialDims || crop->sizeAt(1) != 2) { const std::string expectedCropShape = "[" + std::to_string(numOfSpatialDims) + ", 2]"; // [numOfSpatialDims, 2] REQUIRE_TRUE(false, 0, "BatchToSpaceND: operation expects padding shape to be %s, but got %s instead", expectedCropShape.c_str(), ShapeUtils::shapeAsString(crop).c_str()); diff --git a/libnd4j/include/ops/declarable/generic/parity_ops/space_to_batch_nd.cpp b/libnd4j/include/ops/declarable/generic/parity_ops/space_to_batch_nd.cpp index 085743c98..d3939e303 100644 --- a/libnd4j/include/ops/declarable/generic/parity_ops/space_to_batch_nd.cpp +++ b/libnd4j/include/ops/declarable/generic/parity_ops/space_to_batch_nd.cpp @@ -43,12 +43,6 @@ CUSTOM_OP_IMPL(space_to_batch_nd, 3, 1, false, 0, 0) { REQUIRE_TRUE(input->rankOf() == output->rankOf(), 0, "SpaceToBatchND: rank of input and output array must be the same, but got %i and %i correspondingly !", input->rankOf(), output->rankOf()); - // FIXME - should we use this time-consuming validation ? - for (uint i = 0; i < numOfSpatialDims; ++i) { - const Nd4jLong blockSize = blockShape->e(i); - REQUIRE_TRUE(blockSize >= 2, 0, "SpaceToBatchND: all elements of blockShape array must be >= 2, but got value of %i for element number %i !", blockSize, i); - } - if(padding->sizeAt(0) != numOfSpatialDims || padding->sizeAt(1) != 2) { const std::string expectedpaddingShape = "[" + std::to_string(numOfSpatialDims) + ", 2]"; // [numOfSpatialDims, 2] REQUIRE_TRUE(false, 0, "SpaceToBatchND: operation expects padding shape to be %s, but got %s instead", expectedpaddingShape.c_str(), ShapeUtils::shapeAsString(padding).c_str());