diff --git a/libnd4j/include/ops/declarable/generic/images/rgbToYuv.cpp b/libnd4j/include/ops/declarable/generic/images/rgbToYuv.cpp index 42640aff3..58dd8a432 100644 --- a/libnd4j/include/ops/declarable/generic/images/rgbToYuv.cpp +++ b/libnd4j/include/ops/declarable/generic/images/rgbToYuv.cpp @@ -33,6 +33,10 @@ CONFIGURABLE_OP_IMPL(rgb_to_yuv, 1, 1, true, 0, 0) { auto input = INPUT_VARIABLE(0); auto output = OUTPUT_VARIABLE(0); + // just skip op if input is empty + if (input->isEmpty()) + return Status::OK(); + const int rank = input->rankOf(); const int argSize = block.getIArguments()->size(); const int dimC = argSize > 0 ? (INT_ARG(0) >= 0 ? INT_ARG(0) : INT_ARG(0) + rank) : rank - 1; diff --git a/libnd4j/include/ops/declarable/generic/images/yuvToRgb.cpp b/libnd4j/include/ops/declarable/generic/images/yuvToRgb.cpp index f238e0694..90ca217ce 100644 --- a/libnd4j/include/ops/declarable/generic/images/yuvToRgb.cpp +++ b/libnd4j/include/ops/declarable/generic/images/yuvToRgb.cpp @@ -31,6 +31,10 @@ CONFIGURABLE_OP_IMPL(yuv_to_rgb, 1, 1, true, 0, 0) { auto input = INPUT_VARIABLE(0); auto output = OUTPUT_VARIABLE(0); + // just skip op if input is empty + if (input->isEmpty()) + return Status::OK(); + const int rank = input->rankOf(); const int argSize = block.getIArguments()->size(); const int dimC = argSize > 0 ? (INT_ARG(0) >= 0 ? INT_ARG(0) : INT_ARG(0) + rank) : rank - 1;