diff --git a/libnd4j/include/array/ResultSet.h b/libnd4j/include/array/ResultSet.h index 8215ac940..6c80e7b18 100644 --- a/libnd4j/include/array/ResultSet.h +++ b/libnd4j/include/array/ResultSet.h @@ -15,8 +15,8 @@ ******************************************************************************/ // -// This class is suited for execution results representation. -// +// This class is suited for execution results representation. +// // PLESE NOTE: It will delete all stored NDArrays upon destructor call // // @author raver119@gmail.com @@ -33,13 +33,15 @@ namespace sd { class NDArray; // forward declaration of template class NDArray - + class ND4J_EXPORT ResultSet { private: std::vector _content; Nd4jStatus _status = ND4J_STATUS_OK; bool _removable = true; + void delContent(); + public: explicit ResultSet(); @@ -56,7 +58,7 @@ namespace sd { // move assignment operator ResultSet& operator=(ResultSet&& other) noexcept; - + ~ResultSet(); int size(); diff --git a/libnd4j/include/array/impl/NDArrayList.cpp b/libnd4j/include/array/impl/NDArrayList.cpp index 640392211..deb7828d8 100644 --- a/libnd4j/include/array/impl/NDArrayList.cpp +++ b/libnd4j/include/array/impl/NDArrayList.cpp @@ -160,9 +160,7 @@ namespace sd { auto result = op.evaluate(inputs); - auto array = new NDArray(result->at(0)->dup()); - - delete result; + auto array = new NDArray(result.at(0)->dup()); return array; } diff --git a/libnd4j/include/array/impl/ResultSet.cpp b/libnd4j/include/array/impl/ResultSet.cpp index 3300cc380..d9d824d46 100644 --- a/libnd4j/include/array/impl/ResultSet.cpp +++ b/libnd4j/include/array/impl/ResultSet.cpp @@ -77,15 +77,16 @@ namespace sd { } //////////////////////////////////////////////////////////////////////// - // move assignment operator +// move assignment operator ResultSet& ResultSet::operator=(ResultSet&& other) noexcept { - if (this == &other) + if (this == &other) return *this; - this->~ResultSet(); + delContent(); _content = std::move(other._content); + _status = other._status; _removable = other._removable; other._removable = false; @@ -98,10 +99,10 @@ namespace sd { if (this == &other) return *this; - this->~ResultSet(); + delContent(); - for (const auto v:other._content) - _content.emplace_back(v); + for (const auto v : other._content) + _content.push_back(v); _status = other._status; _removable = false; @@ -109,11 +110,15 @@ namespace sd { return *this; } + void ResultSet::delContent() { + if (_removable) + for (auto v : _content) + delete v; + } ResultSet::~ResultSet() { - if (_removable) - for (auto v: _content) - delete v; + + delContent(); } void ResultSet::setNonRemovable() { diff --git a/libnd4j/include/helpers/impl/GradCheck.cpp b/libnd4j/include/helpers/impl/GradCheck.cpp index 7bd96687d..2643a7b6d 100644 --- a/libnd4j/include/helpers/impl/GradCheck.cpp +++ b/libnd4j/include/helpers/impl/GradCheck.cpp @@ -60,7 +60,7 @@ bool GradCheck::checkGrad(ops::DeclarableOp& opFF, ops::DeclarableOp& opBP, cons fillGradArrays(loss, std::vector(&inArrsBP[numInArrsFF], &inArrsBP[numInArrsFF + numInGradArrsBP])); // back prop pass - ResultSet* outArrsBP = opBP.execute(argsHolderBP); // number of output arrays in back prop = numInArrsFF; + ResultSet outArrsBP = opBP.execute(argsHolderBP); // number of output arrays in back prop = numInArrsFF; NDArray tmpScalar(sd::DataType::DOUBLE, inArrsFF[0]->getContext()); // scalar = 0 @@ -78,18 +78,17 @@ bool GradCheck::checkGrad(ops::DeclarableOp& opFF, ops::DeclarableOp& opBP, cons // add epsilon, feed forward inArrsFF[i]->p(j, orig + EPSILON); - ResultSet* outArrsFF = opFF.execute(argsHolderFF); - int numOutArrs = outArrsFF->size(); + ResultSet outArrsFF = opFF.execute(argsHolderFF); + int numOutArrs = outArrsFF.size(); double scorePlus = 0.; for(int k = 0; k < numOutArrs; ++k) { // loop through output arrays if(loss == SUM) - outArrsFF->at(k)->reduceNumber(reduce::Sum, tmpScalar); + outArrsFF.at(k)->reduceNumber(reduce::Sum, tmpScalar); else - outArrsFF->at(k)->reduceNumber(reduce::Mean, tmpScalar); + outArrsFF.at(k)->reduceNumber(reduce::Mean, tmpScalar); scorePlus += tmpScalar.e(0); } - delete outArrsFF; // subtract epsilon, feed forward inArrsFF[i]->p(j, orig - EPSILON); @@ -98,12 +97,11 @@ bool GradCheck::checkGrad(ops::DeclarableOp& opFF, ops::DeclarableOp& opBP, cons for(int k = 0; k < numOutArrs; ++k) { // loop through output arrays if(loss == SUM) - outArrsFF->at(k)->reduceNumber(reduce::Sum, tmpScalar); + outArrsFF.at(k)->reduceNumber(reduce::Sum, tmpScalar); else - outArrsFF->at(k)->reduceNumber(reduce::Mean, tmpScalar); + outArrsFF.at(k)->reduceNumber(reduce::Mean, tmpScalar); scoreMinus += tmpScalar.e(0); } - delete outArrsFF; // restore initial element value inArrsFF[i]->p(j, orig); @@ -116,7 +114,7 @@ bool GradCheck::checkGrad(ops::DeclarableOp& opFF, ops::DeclarableOp& opBP, cons } // get analytical gradient - const double analyticGrad = outArrsBP->at(i)->e(j); + const double analyticGrad = outArrsBP.at(i)->e(j); if(std::isnan(analyticGrad) || std::isinf(analyticGrad)) { printf("GradCheck::checkGrad: got wrong value for analytical gradient for input array # %i and its element at position %lld ! \n", i, j); throw std::runtime_error(""); @@ -138,13 +136,11 @@ bool GradCheck::checkGrad(ops::DeclarableOp& opFF, ops::DeclarableOp& opBP, cons continue; printf("numericalGrad = %f, analyticGrad = %f \n", numericalGrad, analyticGrad); printf("GradCheck::checkGrad: got RELERROR = %f > MAXRELERROR(%f) for input array # %i and its element at position %lld ! \n", relError, MAXRELERR, i, j); - delete outArrsBP; return false; } } } - delete outArrsBP; return true; } diff --git a/libnd4j/include/ops/declarable/DeclarableListOp.h b/libnd4j/include/ops/declarable/DeclarableListOp.h index 3031611f8..cc77ee17b 100644 --- a/libnd4j/include/ops/declarable/DeclarableListOp.h +++ b/libnd4j/include/ops/declarable/DeclarableListOp.h @@ -45,8 +45,8 @@ namespace sd { Nd4jStatus execute(Context* block) override; - ResultSet* execute(NDArrayList* list, std::initializer_list inputs, std::initializer_list tArgs, std::initializer_list iArgs); - ResultSet* execute(NDArrayList* list, std::vector& inputs, std::vector& tArgs, std::vector& iArgs); + ResultSet execute(NDArrayList* list, std::initializer_list inputs, std::initializer_list tArgs, std::initializer_list iArgs); + ResultSet execute(NDArrayList* list, std::vector& inputs, std::vector& tArgs, std::vector& iArgs); ShapeList* calculateOutputShape(ShapeList* inputShape, sd::graph::Context& block) override; }; diff --git a/libnd4j/include/ops/declarable/DeclarableOp.h b/libnd4j/include/ops/declarable/DeclarableOp.h index fd95f382d..d07c7b6a3 100644 --- a/libnd4j/include/ops/declarable/DeclarableOp.h +++ b/libnd4j/include/ops/declarable/DeclarableOp.h @@ -176,17 +176,17 @@ namespace sd { Nd4jStatus execute(const std::vector &inputs, const std::vector &outputs, const std::vector &tArgs, const std::vector &iArgs, const std::vector &bArgs = std::vector(), const std::vector &dArgs = std::vector(), bool isInplace = false); - - sd::ResultSet* evaluate(const std::vector &inputs); + sd::ResultSet evaluate(const std::vector &inputs); template ::value>> - sd::ResultSet* evaluate(const std::vector &inputs, std::initializer_list args); + sd::ResultSet evaluate(const std::vector &inputs, std::initializer_list args); - sd::ResultSet* evaluate(const std::vector &inputs, const std::vector &tArgs, const std::vector &iArgs, const std::vector &bArgs = std::vector(), const std::vector &dArgs = std::vector(), bool isInplace = false); + sd::ResultSet evaluate(const std::vector &inputs, const std::vector &tArgs, const std::vector &iArgs, const std::vector &bArgs = std::vector(), const std::vector &dArgs = std::vector(), bool isInplace = false); Nd4jStatus execute(sd::graph::RandomGenerator& rng, const std::vector& inputs, const std::vector& outputs, const std::vector& tArgs, const std::vector& iArgs, const std::vector& bArgs, const std::vector &dArgs = std::vector(), bool isInplace = false, sd::DataType type = sd::DataType::FLOAT32); - sd::ResultSet* execute(const sd::OpArgsHolder& holder, bool isInplace = false); + sd::ResultSet execute(const sd::OpArgsHolder& holder, bool isInplace = false); + // There methods provide various validation options Nd4jStatus validateNonEmptyInput(Context& block); diff --git a/libnd4j/include/ops/declarable/LegacyRandomOp.h b/libnd4j/include/ops/declarable/LegacyRandomOp.h index b6e6f5b16..2fac9c689 100644 --- a/libnd4j/include/ops/declarable/LegacyRandomOp.h +++ b/libnd4j/include/ops/declarable/LegacyRandomOp.h @@ -41,8 +41,9 @@ namespace sd { template Nd4jStatus validateAndExecute_(Context &block); - sd::ResultSet* execute(sd::graph::RandomGenerator& rng, std::initializer_list inputs, std::initializer_list tArgs, std::initializer_list iArgs, bool isInplace = false); - sd::ResultSet* execute(sd::graph::RandomGenerator& rng, std::vector& inputs, std::vector& tArgs, std::vector& iArgs, bool isInplace = false); + sd::ResultSet execute(sd::graph::RandomGenerator& rng, std::initializer_list inputs, std::initializer_list tArgs, std::initializer_list iArgs, bool isInplace = false); + sd::ResultSet execute(sd::graph::RandomGenerator& rng, std::vector& inputs, std::vector& tArgs, std::vector& iArgs, bool isInplace = false); + Nd4jStatus execute(Context* block) override; ShapeList* calculateOutputShape(ShapeList* inputShape, sd::graph::Context& block) override; diff --git a/libnd4j/include/ops/declarable/generic/activations/crelu.cpp b/libnd4j/include/ops/declarable/generic/activations/crelu.cpp index 4ce40f121..539b21145 100644 --- a/libnd4j/include/ops/declarable/generic/activations/crelu.cpp +++ b/libnd4j/include/ops/declarable/generic/activations/crelu.cpp @@ -74,10 +74,10 @@ namespace sd { // at first step we build fwd activation sd::ops::crelu op; auto tmpResult = op.evaluate({input}); - if (tmpResult->status() != ND4J_STATUS_OK) - return tmpResult->status(); + if (tmpResult.status() != ND4J_STATUS_OK) + return tmpResult.status(); - auto actv = tmpResult->at(0); + auto actv = tmpResult.at(0); // now we do RELU backward pass //actv->applyPairwiseTransform(pairwise::RELUDerivativeE, *epsilon, nullptr); @@ -85,17 +85,15 @@ namespace sd { // now we split updated array into 2 chunks along last dimension sd::ops::concat_bp opc; auto dec = opc.evaluate({input, input, actv}, {-1}); - if (dec->status() != ND4J_STATUS_OK) - return dec->status(); + if (dec.status() != ND4J_STATUS_OK) + return dec.status(); // and now we subtract two parts of epsilons and pass result out - auto pos = dec->at(0); - auto neg = dec->at(1); + auto pos = dec.at(0); + auto neg = dec.at(1); pos->applyPairwiseTransform(sd::pairwise::Subtract, *neg, *epsilon); - delete tmpResult; - delete dec; return ND4J_STATUS_OK; } diff --git a/libnd4j/include/ops/declarable/generic/boolean/where_np.cpp b/libnd4j/include/ops/declarable/generic/boolean/where_np.cpp index 9a03acf11..65cb52cdd 100644 --- a/libnd4j/include/ops/declarable/generic/boolean/where_np.cpp +++ b/libnd4j/include/ops/declarable/generic/boolean/where_np.cpp @@ -102,10 +102,12 @@ namespace sd { REQUIRE_TRUE(block.width() == 1, 0, "Where op takes either 1 or 3 operands, But got %d operands instead", block.width()); // if (output->isEmpty()) Nd4jLong width = condition->rankOf(); + sd::ops::Where op; - std::unique_ptr res(op.evaluate({condition})); - REQUIRE_OK(res->status()); - NDArray* whereTrue = res->at(0); + auto res(op.evaluate({condition})); + REQUIRE_OK(res.status()); + NDArray* whereTrue = res.at(0); + if (whereTrue->isEmpty()) return ND4J_STATUS_OK; for (Nd4jLong outNext = 0; outNext < width; ++outNext) { diff --git a/libnd4j/include/ops/declarable/generic/broadcastable/floormod.cpp b/libnd4j/include/ops/declarable/generic/broadcastable/floormod.cpp index 8ed93dd3a..52377739b 100644 --- a/libnd4j/include/ops/declarable/generic/broadcastable/floormod.cpp +++ b/libnd4j/include/ops/declarable/generic/broadcastable/floormod.cpp @@ -65,11 +65,12 @@ namespace sd { auto gradX = OUTPUT_VARIABLE(0); auto gradY = OUTPUT_VARIABLE(1); gradX->assign(epsNext); + sd::ops::floormod op; - std::unique_ptr tmpResult(op.evaluate({x, y})); + auto tmpResult(op.evaluate({x, y})); if (gradY->rankOf() == gradX->rankOf()) - epsNext->applyPairwiseTransform(pairwise::Multiply, *tmpResult->at(0), *gradY); + epsNext->applyPairwiseTransform(pairwise::Multiply, *tmpResult.at(0), *gradY); else // epsNext is greater than gradY { std::vector dims(epsNext->rankOf() * 2); @@ -77,7 +78,7 @@ namespace sd { for (Nd4jLong d = 0; d < gap; d++) { dims[d * 2 + 1] = 1; } - auto tempIn((*tmpResult->at(0))(dims)); + auto tempIn((*tmpResult.at(0))(dims)); (*epsNext)(dims).applyPairwiseTransform(pairwise::Multiply, tempIn, *gradY); } return Status::OK(); diff --git a/libnd4j/include/ops/declarable/generic/parity_ops/dynamic_parititon.cpp b/libnd4j/include/ops/declarable/generic/parity_ops/dynamic_parititon.cpp index 8c54ab129..6a055c02c 100644 --- a/libnd4j/include/ops/declarable/generic/parity_ops/dynamic_parititon.cpp +++ b/libnd4j/include/ops/declarable/generic/parity_ops/dynamic_parititon.cpp @@ -113,23 +113,21 @@ namespace ops { originalIndices.linspace(0); ops::dynamic_partition op; auto res = op.evaluate({&originalIndices, indices}, {numPartition}); - REQUIRE_TRUE(res->status() == ND4J_STATUS_OK, 0, "dynamic_partition_bp: Error with dynamic partitioning."); + REQUIRE_TRUE(res.status() == ND4J_STATUS_OK, 0, "dynamic_partition_bp: Error with dynamic partitioning."); ops::dynamic_stitch stichOp; std::vector partitions(numPartition * 2); - for (size_t i = 0; i < res->size(); i++) { - partitions[i] = res->at(i); + for (size_t i = 0; i < res.size(); i++) { + partitions[i] = res.at(i); partitions[i + numPartition] = gradOutList[i]; } auto result = stichOp.evaluate(partitions, {numPartition}); - REQUIRE_TRUE(result->status() == ND4J_STATUS_OK, 0, "dynamic_partition_bp: Error with dynamic partitioning."); - result->at(0)->reshapei(outputList[0]->getShapeAsVector()); + REQUIRE_TRUE(result.status() == ND4J_STATUS_OK, 0, "dynamic_partition_bp: Error with dynamic partitioning."); + result.at(0)->reshapei(outputList[0]->getShapeAsVector()); outputList[1]->assign(indices); - outputList[0]->assign(result->at(0)); + outputList[0]->assign(result.at(0)); // helpers::dynamicPartitionFunctorBP(block.launchContext(), input, indices, gradOutList, outputList); - delete res; - delete result; return ND4J_STATUS_OK; } diff --git a/libnd4j/include/ops/declarable/generic/parity_ops/embedding_lookup.cpp b/libnd4j/include/ops/declarable/generic/parity_ops/embedding_lookup.cpp index 0c3dc35f3..0888854ee 100644 --- a/libnd4j/include/ops/declarable/generic/parity_ops/embedding_lookup.cpp +++ b/libnd4j/include/ops/declarable/generic/parity_ops/embedding_lookup.cpp @@ -66,10 +66,10 @@ CUSTOM_OP_IMPL(embedding_lookup, 2, 1, false, 0, 1) { sd::ops::gather op; - std::unique_ptr result(op.evaluate({input, indeces}, {0})); - REQUIRE_TRUE(result->status() == Status::OK(), 0, "embedding_lookup: cannot retrieve results from gather op."); - REQUIRE_TRUE(result->at(0)->isSameShape(output), 0, "embedding_lookup: wrong shape of return from gather op."); - output->assign(result->at(0)); + auto result(op.evaluate({input, indeces}, {0})); + REQUIRE_TRUE(result.status() == Status::OK(), 0, "embedding_lookup: cannot retrieve results from gather op."); + REQUIRE_TRUE(result.at(0)->isSameShape(output), 0, "embedding_lookup: wrong shape of return from gather op."); + output->assign(result.at(0)); } return Status::OK(); } diff --git a/libnd4j/include/ops/declarable/generic/recurrent/dynamicBidirectionalRNN.cpp b/libnd4j/include/ops/declarable/generic/recurrent/dynamicBidirectionalRNN.cpp index f114c642e..33fd5e8ea 100644 --- a/libnd4j/include/ops/declarable/generic/recurrent/dynamicBidirectionalRNN.cpp +++ b/libnd4j/include/ops/declarable/generic/recurrent/dynamicBidirectionalRNN.cpp @@ -95,8 +95,8 @@ CUSTOM_OP_IMPL(dynamic_bidirectional_rnn, 7, 4, false, 0, 0) { // forward steps sd::ops::dynamic_rnn dynamicRnn; auto resultsFW = dynamicRnn.evaluate({x, WxFW, WhFW, bFW, h0FW, maxTimeStep}, {timeMajor}); - hFW->assign(resultsFW->at(0)); // [time x bS x numUnitsFW] or [bS x time x numUnitsFW] - hFWFinal->assign(resultsFW->at(1)); + hFW->assign(resultsFW.at(0)); // [time x bS x numUnitsFW] or [bS x time x numUnitsFW] + hFWFinal->assign(resultsFW.at(1)); auto seqLen = maxTimeStep; if(seqLen == nullptr) { @@ -108,22 +108,17 @@ CUSTOM_OP_IMPL(dynamic_bidirectional_rnn, 7, 4, false, 0, 0) { // reverse x sd::ops::reverse_sequence reverse; auto resultsIn = timeMajor ? reverse.evaluate({x, seqLen}, {0, 1}) : reverse.evaluate({x, seqLen}, {1, 0}); - REQUIRE_TRUE (resultsIn->status() == ND4J_STATUS_OK, 0, "dynamic_bidirectional_rnn: there is a problem with reverse on the sequence."); - auto revInput = resultsIn->at(0); + REQUIRE_TRUE (resultsIn.status() == ND4J_STATUS_OK, 0, "dynamic_bidirectional_rnn: there is a problem with reverse on the sequence."); + auto revInput = resultsIn.at(0); // backward steps auto resultsBW = dynamicRnn.evaluate({revInput, WxBW, WhBW, bBW, h0BW, maxTimeStep}, {timeMajor}); - auto hBWtemp = resultsBW->at(0); // [time x bS x numUnitsBW] or [ bS x time xnumUnitsBW] - hBWFinal->assign(resultsBW->at(1)); + auto hBWtemp = resultsBW.at(0); // [time x bS x numUnitsBW] or [ bS x time xnumUnitsBW] + hBWFinal->assign(resultsBW.at(1)); // reverse hBWtemp auto resultsOut = timeMajor ? reverse.evaluate({hBWtemp, seqLen}, {0, 1}) : reverse.evaluate({hBWtemp, seqLen}, {1, 0}); - hBW->assign(resultsOut->at(0)); - - delete resultsOut; - delete resultsBW; - delete resultsIn; - delete resultsFW; + hBW->assign(resultsOut.at(0)); if(seqLen != maxTimeStep) delete seqLen; @@ -228,12 +223,6 @@ DECLARE_SHAPE_FN(dynamic_bidirectional_rnn) { } - - - - - - } } diff --git a/libnd4j/include/ops/declarable/helpers/impl/multiUnique.cpp b/libnd4j/include/ops/declarable/helpers/impl/multiUnique.cpp index 9d8962cda..ff9ae3144 100644 --- a/libnd4j/include/ops/declarable/helpers/impl/multiUnique.cpp +++ b/libnd4j/include/ops/declarable/helpers/impl/multiUnique.cpp @@ -52,14 +52,13 @@ namespace helpers { sd::ops::unique opUnique; auto uResult = opUnique.evaluate({&arrayFull}); - if (Status::OK() != uResult->status()) + if (Status::OK() != uResult.status()) throw std::runtime_error("multiUnique: cannot execute unique op properly."); - auto uniqueVals = uResult->at(0); + auto uniqueVals = uResult.at(0); bool res = uniqueVals->lengthOf() == arrayFull.lengthOf(); - delete uResult; return res; } diff --git a/libnd4j/include/ops/declarable/impl/DeclarableListOp.cpp b/libnd4j/include/ops/declarable/impl/DeclarableListOp.cpp index 774917d70..13aa763f8 100644 --- a/libnd4j/include/ops/declarable/impl/DeclarableListOp.cpp +++ b/libnd4j/include/ops/declarable/impl/DeclarableListOp.cpp @@ -64,7 +64,7 @@ namespace sd { block.pushNDArrayListToVariableSpace(block.getNodeId(), 0, arrayList); } - ResultSet* DeclarableListOp::execute(NDArrayList* list, std::initializer_list inputs, std::initializer_list tArgs, std::initializer_list iArgs) { + ResultSet DeclarableListOp::execute(NDArrayList* list, std::initializer_list inputs, std::initializer_list tArgs, std::initializer_list iArgs) { std::vector ins(inputs); std::vector tas(tArgs); std::vector ias(iArgs); @@ -94,7 +94,7 @@ namespace sd { return status; } - ResultSet* DeclarableListOp::execute(NDArrayList* list, std::vector& inputs, std::vector& tArgs, std::vector& iArgs) { + ResultSet DeclarableListOp::execute(NDArrayList* list, std::vector& inputs, std::vector& tArgs, std::vector& iArgs) { VariableSpace varSpace; int nodeId = 119; @@ -132,8 +132,8 @@ namespace sd { Nd4jStatus result = this->validateAndExecute(block); - auto res = new ResultSet(); - res->setStatus(result); + ResultSet res; + res.setStatus(result); for (int e = 0; e < DataTypeUtils::max(); e++) { std::pair pair(1, e); @@ -143,10 +143,10 @@ namespace sd { auto arr = var->getNDArray(); if (arr->isAttached()) { auto d = arr->detach(); - res->push_back(d); + res.push_back(d); } else { var->markRemovable(false); - res->push_back(arr); + res.push_back(arr); } } } else diff --git a/libnd4j/include/ops/declarable/impl/DeclarableOp.cpp b/libnd4j/include/ops/declarable/impl/DeclarableOp.cpp index 493834a4e..2c1d52348 100644 --- a/libnd4j/include/ops/declarable/impl/DeclarableOp.cpp +++ b/libnd4j/include/ops/declarable/impl/DeclarableOp.cpp @@ -962,12 +962,12 @@ namespace sd { return execute(&ctx); } - sd::ResultSet *DeclarableOp::evaluate(const std::vector &inputs) { + sd::ResultSet DeclarableOp::evaluate(const std::vector &inputs) { return evaluate(inputs, std::vector(), std::vector(), std::vector(), std::vector()); } template <> - sd::ResultSet *DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list iArgs) { + sd::ResultSet DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list iArgs) { std::vector realArgs; for (auto v:iArgs) realArgs.emplace_back(v); @@ -976,12 +976,12 @@ namespace sd { } template <> - sd::ResultSet *DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list iArgs) { + sd::ResultSet DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list iArgs) { return evaluate(inputs, std::vector(), iArgs, std::vector(), std::vector()); } template <> - sd::ResultSet *DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list tArgs) { + sd::ResultSet DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list tArgs) { std::vector realArgs; for (auto v:tArgs) realArgs.emplace_back(v); @@ -990,21 +990,21 @@ namespace sd { } template <> - sd::ResultSet *DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list tArgs) { + sd::ResultSet DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list tArgs) { return evaluate(inputs, tArgs, std::vector(), std::vector(), std::vector()); } template <> - sd::ResultSet *DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list bArgs) { + sd::ResultSet DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list bArgs) { return evaluate(inputs, std::vector(), std::vector(), bArgs, std::vector()); } template <> - sd::ResultSet *DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list bArgs) { + sd::ResultSet DeclarableOp::evaluate(const std::vector &inputs, std::initializer_list bArgs) { return evaluate(inputs, std::vector(), std::vector(), std::vector(), bArgs); } - sd::ResultSet *DeclarableOp::evaluate(const std::vector &inputs, const std::vector &tArgs, const std::vector &iArgs, const std::vector &bArgs, const std::vector &dArgs, bool isInplace) { + sd::ResultSet DeclarableOp::evaluate(const std::vector &inputs, const std::vector &tArgs, const std::vector &iArgs, const std::vector &bArgs, const std::vector &dArgs, bool isInplace) { VariableSpace variableSpace; //ResultSet arrayList; FlowPath fp; @@ -1041,11 +1041,11 @@ namespace sd { block.getDArguments()->push_back(dArgs.at(e)); Nd4jStatus status = this->execute(&block); - auto arrayList = new ResultSet(); + ResultSet arrayList; if (isInplace) - arrayList->setNonRemovable(); + arrayList.setNonRemovable(); - arrayList->setStatus(status); + arrayList.setStatus(status); if (status != ND4J_STATUS_OK) return arrayList; @@ -1058,23 +1058,23 @@ namespace sd { if (!arr->isAttached()) { var->markRemovable(false); arr->setContext(sd::LaunchContext::defaultContext()); - arrayList->push_back(arr); + arrayList.push_back(arr); } else { - arrayList->push_back(arr->detach()); + arrayList.push_back(arr->detach()); } } else break; } } else { for (auto v:inputs) { - arrayList->push_back(v); + arrayList.push_back(v); } } return arrayList; } - sd::ResultSet* sd::ops::DeclarableOp::execute(const sd::OpArgsHolder& holder, bool isInplace) { + sd::ResultSet sd::ops::DeclarableOp::execute(const sd::OpArgsHolder& holder, bool isInplace) { // FIXME: add DArgs to OpArgsHolder return evaluate(holder.getInArrs(), holder.getTArgs(), holder.getIArgs(), holder.getBArgs(), std::vector(), isInplace); } diff --git a/libnd4j/include/ops/declarable/impl/LegacyRandomOp.cpp b/libnd4j/include/ops/declarable/impl/LegacyRandomOp.cpp index 88ef39237..b411271fc 100644 --- a/libnd4j/include/ops/declarable/impl/LegacyRandomOp.cpp +++ b/libnd4j/include/ops/declarable/impl/LegacyRandomOp.cpp @@ -357,20 +357,20 @@ namespace sd { return DeclarableOp::execute(block); } - sd::ResultSet* LegacyRandomOp::execute(sd::graph::RandomGenerator& rng, std::initializer_list inputs, std::initializer_list tArgs, std::initializer_list iArgs, bool isInplace) { + sd::ResultSet LegacyRandomOp::execute(sd::graph::RandomGenerator& rng, std::initializer_list inputs, std::initializer_list tArgs, std::initializer_list iArgs, bool isInplace) { std::vector ins(inputs); std::vector tas(tArgs); std::vector ias(iArgs); return this->execute(rng, ins, tas, ias, isInplace); } - sd::ResultSet* LegacyRandomOp::execute(sd::graph::RandomGenerator& rng, std::vector& inputs, std::vector& tArgs, std::vector& iArgs, bool isInplace) { + sd::ResultSet LegacyRandomOp::execute(sd::graph::RandomGenerator& rng, std::vector& inputs, std::vector& tArgs, std::vector& iArgs, bool isInplace) { VariableSpace variableSpace; - auto arrayList = new ResultSet(); + ResultSet arrayList; //ResultSet arrayList; if (isInplace) - arrayList->setNonRemovable(); + arrayList.setNonRemovable(); int cnt = -1; std::vector in; @@ -398,7 +398,7 @@ namespace sd { block.getIArguments()->emplace_back(iArgs.at(e)); Nd4jStatus status = this->execute(&block); - arrayList->setStatus(status); + arrayList.setStatus(status); if (status != ND4J_STATUS_OK) return arrayList; @@ -410,9 +410,9 @@ namespace sd { auto arr = var->getNDArray(); if (!arr->isAttached()) { var->markRemovable(false); - arrayList->push_back(arr); + arrayList.push_back(arr); } else { - arrayList->push_back(arr->detach()); + arrayList.push_back(arr->detach()); } } else break; @@ -423,4 +423,4 @@ namespace sd { BUILD_SINGLE_TEMPLATE(template Nd4jStatus LegacyRandomOp::validateAndExecute_, (Context&), FLOAT_TYPES); } -} \ No newline at end of file +} diff --git a/libnd4j/tests_cpu/layers_tests/AttentionTests.cpp b/libnd4j/tests_cpu/layers_tests/AttentionTests.cpp index 28fe404e1..ab6d50b53 100644 --- a/libnd4j/tests_cpu/layers_tests/AttentionTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/AttentionTests.cpp @@ -44,9 +44,7 @@ TEST_F(AttentionTests, basic_dot_product_attention) { sd::ops::dot_product_attention op; auto result = op.evaluate({&queries, &keys, &values}, {1, 0}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } /* @@ -72,9 +70,7 @@ TEST_F(AttentionTests, basic_dot_product_attention_with_weights) { sd::ops::dot_product_attention op; auto result = op.evaluate({&queries, &keys, &values}, {1, 1}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } TEST_F(AttentionTests, basic_dot_product_attention_with_mask) { @@ -86,9 +82,7 @@ TEST_F(AttentionTests, basic_dot_product_attention_with_mask) { sd::ops::dot_product_attention op; auto result = op.evaluate({&queries, &keys, &values, &mask}, {1, 0}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } /* @@ -118,9 +112,7 @@ TEST_F(AttentionTests, multi_head_input_dot_product_attention_with_mask) { sd::ops::dot_product_attention op; auto result = op.evaluate({&queries, &keys, &values, &mask}, {1, 0}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } /* @@ -154,9 +146,7 @@ TEST_F(AttentionTests, basic_multi_head_dot_product_attention) { sd::ops::multi_head_dot_product_attention op; auto result = op.evaluate({&queries, &keys, &values, &Wk, &Wv, &Wq, &Wo}, {1, 0}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } /* @@ -198,9 +188,7 @@ TEST_F(AttentionTests, basic_multi_head_dot_product_attention_with_mask) { sd::ops::multi_head_dot_product_attention op; auto result = op.evaluate({&queries, &keys, &values, &Wk, &Wv, &Wq, &Wo, &mask}, {1, 0}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } /* diff --git a/libnd4j/tests_cpu/layers_tests/BackpropTests.cpp b/libnd4j/tests_cpu/layers_tests/BackpropTests.cpp index fc08184b9..5c528f072 100644 --- a/libnd4j/tests_cpu/layers_tests/BackpropTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/BackpropTests.cpp @@ -39,13 +39,11 @@ TEST_F(BackpropTests, Test_Add_1) { sd::ops::add_bp op; auto result = op.evaluate({&x, &y, &e}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto eps = result->at(0); - auto grad = result->at(1); + auto eps = result.at(0); + auto grad = result.at(1); ASSERT_TRUE(x.isSameShape(eps)); ASSERT_TRUE(y.isSameShape(grad)); - - delete result; } \ No newline at end of file diff --git a/libnd4j/tests_cpu/layers_tests/BooleanOpsTests.cpp b/libnd4j/tests_cpu/layers_tests/BooleanOpsTests.cpp index ce6b61707..199cb88eb 100644 --- a/libnd4j/tests_cpu/layers_tests/BooleanOpsTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/BooleanOpsTests.cpp @@ -137,13 +137,12 @@ TEST_F(BooleanOpsTests, test_where_1) { sd::ops::choose op; auto result = op.evaluate({&x, &y}, {3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("z"); ASSERT_EQ(e, *z); - - delete result; } + diff --git a/libnd4j/tests_cpu/layers_tests/BroadcastableOpsTests.cpp b/libnd4j/tests_cpu/layers_tests/BroadcastableOpsTests.cpp index 3861c0ad8..51c6e2375 100644 --- a/libnd4j/tests_cpu/layers_tests/BroadcastableOpsTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/BroadcastableOpsTests.cpp @@ -48,9 +48,9 @@ TEST_F(BroadcastableOpsTests, Test_Add_1) { sd::ops::add op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //exp.printIndexedBuffer("E A"); //z->printIndexedBuffer("Z"); @@ -58,7 +58,6 @@ TEST_F(BroadcastableOpsTests, Test_Add_1) { ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -75,14 +74,12 @@ TEST_F(BroadcastableOpsTests, Test_Multiply_1) { sd::ops::multiply op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } @@ -100,14 +97,13 @@ TEST_F(BroadcastableOpsTests, Test_SquaredSubtract_1) { sd::ops::squaredsubtract op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -119,14 +115,12 @@ TEST_F(BroadcastableOpsTests, Test_ScalarBroadcast_1) { sd::ops::subtract op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } @@ -138,14 +132,12 @@ TEST_F(BroadcastableOpsTests, Test_ScalarBroadcast_2) { sd::ops::add op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } @@ -156,14 +148,12 @@ TEST_F(BroadcastableOpsTests, Test_Maximum_1) { sd::ops::maximum op; auto result = op.evaluate({&x, &row}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } @@ -174,15 +164,14 @@ TEST_F(BroadcastableOpsTests, Test_Minimum_1) { sd::ops::minimum op; auto result = op.evaluate({&x, &col}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -283,14 +272,13 @@ TEST_F(BroadcastableOpsTests, Test_Scalar_Add_1) { sd::ops::add op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -333,11 +321,9 @@ TEST_F(BroadcastableOpsTests, Test_Subtract_2) { sd::ops::subtract op; auto result = op.evaluate({&x, &y}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.equalsTo(z)); - - delete result; } TEST_F(BroadcastableOpsTests, Test_Subtract_3) { @@ -511,13 +497,12 @@ TEST_F(BroadcastableOpsTests, Test_Multiply_7) { sd::ops::multiply op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.equalsTo(z)); - delete result; } TEST_F(BroadcastableOpsTests, Test_Multiply_8) { @@ -527,13 +512,11 @@ TEST_F(BroadcastableOpsTests, Test_Multiply_8) { sd::ops::multiply op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////// @@ -606,14 +589,12 @@ TEST_F(BroadcastableOpsTests, broadcast_empty_3) { sd::ops::maximum op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - - delete result; } TEST_F(BroadcastableOpsTests, broadcast_empty_4) { @@ -625,14 +606,13 @@ TEST_F(BroadcastableOpsTests, broadcast_empty_4) { sd::ops::maximum op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; } TEST_F(BroadcastableOpsTests, broadcast_empty_5) { @@ -644,14 +624,13 @@ TEST_F(BroadcastableOpsTests, broadcast_empty_5) { sd::ops::realdiv op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; } TEST_F(BroadcastableOpsTests, broadcast_empty_6) { @@ -663,14 +642,13 @@ TEST_F(BroadcastableOpsTests, broadcast_empty_6) { sd::ops::realdiv op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; } TEST_F(BroadcastableOpsTests, broadcast_empty_7) { @@ -682,14 +660,12 @@ TEST_F(BroadcastableOpsTests, broadcast_empty_7) { sd::ops::realdiv op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - - delete result; } @@ -718,15 +694,13 @@ TEST_F(BroadcastableOpsTests, broadcast_bool_empty_2) { sd::ops::greater op; auto result = op.evaluate({&x, &y}); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - - delete result; } TEST_F(BroadcastableOpsTests, broadcast_bool_1) { diff --git a/libnd4j/tests_cpu/layers_tests/ConvolutionTests1.cpp b/libnd4j/tests_cpu/layers_tests/ConvolutionTests1.cpp index 6b9109731..b296a8903 100644 --- a/libnd4j/tests_cpu/layers_tests/ConvolutionTests1.cpp +++ b/libnd4j/tests_cpu/layers_tests/ConvolutionTests1.cpp @@ -141,14 +141,12 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_2) { sd::ops::conv2d op; auto result = op.evaluate({&input, &weights}, {}, {1, 1, 1, 1, 0, 0, 1, 1, 0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////// @@ -173,14 +171,14 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_3) { sd::ops::conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -202,14 +200,12 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_4) { sd::ops::conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -232,16 +228,14 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_5) { sd::ops::conv2d op; auto results = op.evaluate({&input, &weights, &bias}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); // output->printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -251,9 +245,7 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_6) { sd::ops::conv2d op; auto result = op.evaluate({&input, &weights}, {}, {-1,-1, 1,1, 0,0, 1,1, 1,1}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } ////////////////////////////////////////////////////////////////////// @@ -272,11 +264,11 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_7) { sd::ops::conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -306,16 +298,15 @@ TEST_F(ConvolutionTests1, conv2d_8) { sd::ops::conv2d op; auto results = op.evaluate({&input, &weights, &bias}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); // output->printBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -421,7 +412,7 @@ TYPED_TEST(TypedConvolutionTests1, sconv2d_2) { auto resultFF = op.evaluate({&input, &weightsD, &weightsP}, {5, 5, 1, 1, 0, 0, 1, 1, 0, 0}); - auto z = resultFF->at(0); + auto z = resultFF.at(0); //z->printShapeInfo("FF shape"); @@ -430,8 +421,6 @@ TYPED_TEST(TypedConvolutionTests1, sconv2d_2) { //expFF.printBuffer("e"); //z->printBuffer("z"); ASSERT_TRUE(z->equalsTo(&expFF, 1e-3)); - - delete resultFF; } TYPED_TEST(TypedConvolutionTests1, sconv2d_3) { @@ -455,7 +444,7 @@ TYPED_TEST(TypedConvolutionTests1, sconv2d_3) { Nd4jStatus status = op.execute({&input, &weightsD, &weightsP, &bias}, {&output}, {1, 1, 1, 1, 0, 0, 1, 1, 0}); auto result = op.evaluate({&input, &weightsD, &weightsP, &bias}, {1, 1, 1, 1, 0, 0, 1, 1, 0}); - auto z = result->at(0); + auto z = result.at(0); //printf("\n"); //output.printBuffer("output"); @@ -463,8 +452,6 @@ TYPED_TEST(TypedConvolutionTests1, sconv2d_3) { //ASSERT_TRUE(expOutput.isSameShape(z)); - - delete result; } ////////////////////////////////////////////////////////////////////// @@ -494,14 +481,13 @@ TEST_F(ConvolutionTests1, sconv2d_4) { sd::ops::sconv2d op; auto results = op.evaluate({&input, &weightsD, &weightsP, &biases}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } TYPED_TEST(TypedConvolutionTests1, conv2D_BP_Bias_1) { @@ -533,11 +519,11 @@ TYPED_TEST(TypedConvolutionTests1, conv2D_BP_Bias_1) { auto results = op.evaluate({&input, &weights, &bias, &epsilonNext}, {}, {3, 3, 1, 1, 0, 0, 1, 1, 1}, {}); - ASSERT_TRUE(results->size() == 3); + ASSERT_TRUE(results.size() == 3); - auto epsilon = results->at(0); - auto gradW = results->at(1); - auto gradB = results->at(2); + auto epsilon = results.at(0); + auto gradW = results.at(1); + auto gradB = results.at(2); ASSERT_TRUE(expWGrad.isSameShape(gradW)); @@ -556,7 +542,7 @@ TYPED_TEST(TypedConvolutionTests1, conv2D_BP_Bias_1) { ASSERT_TRUE(expBGrad.equalsTo(gradB)); - delete results; + } @@ -583,10 +569,10 @@ TYPED_TEST(TypedConvolutionTests1, conv2D_BP_NoBias_1) { auto results = op.evaluate({&input, &weights, &epsilonNext}, {}, {3, 3, 1, 1, 0, 0, 1, 1, 1}, {}); - ASSERT_TRUE(results->size() == 2); + ASSERT_TRUE(results.size() == 2); - auto epsilon = results->at(0); - auto gradW = results->at(1); + auto epsilon = results.at(0); + auto gradW = results.at(1); ASSERT_TRUE(expWGrad.isSameShape(gradW)); @@ -601,7 +587,7 @@ TYPED_TEST(TypedConvolutionTests1, conv2D_BP_NoBias_1) { //epsilon->printBuffer("Result buffer"); ASSERT_TRUE(expEps.equalsTo(epsilon)); - delete results; + } TYPED_TEST(TypedConvolutionTests1, sconv2d_conv2d_1) { @@ -666,7 +652,7 @@ TYPED_TEST(TypedConvolutionTests1, sconv2d_conv2d_1) { sd::ops::sconv2d op; auto resultFF = op.evaluate({&input, &weightsD}, {}, {5, 5, 1, 1, 0, 0, 1, 1, 0}, {}); - auto z = resultFF->at(0); + auto z = resultFF.at(0); ASSERT_TRUE(z->isSameShape(&expFF)); ASSERT_TRUE(z->equalsTo(&expFF, 1)); @@ -676,14 +662,11 @@ TYPED_TEST(TypedConvolutionTests1, sconv2d_conv2d_1) { // weightsP.printShapeInfo(); auto result2D = op2d.evaluate({z, &weightsP}, {}, {1, 1, 1, 1, 0, 0, 1, 1, 0, 0}, {}); - auto z2d = result2D->at(0); + auto z2d = result2D.at(0); // z2d->printBuffer(); ASSERT_TRUE(z2d->isSameShape(&exp2FF)); ASSERT_TRUE(z2d->equalsTo(&exp2FF)); - - delete resultFF; - delete result2D; } TEST_F(ConvolutionTests1, TestDeconv_bp_1) { @@ -719,12 +702,12 @@ TEST_F(ConvolutionTests1, TestDeconv_bp_1) { sd::ops::deconv2d_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); - - auto gradI = results->at(0); - auto gradW = results->at(1); - auto gradB = results->at(2); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); + auto gradI = results.at(0); + auto gradW = results.at(1); + auto gradB = results.at(2); + ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -734,8 +717,8 @@ TEST_F(ConvolutionTests1, TestDeconv_bp_1) { ASSERT_TRUE(expGradB.isSameShape(gradB)); ASSERT_TRUE(expGradB.equalsTo(gradB)); - delete results; } + TEST_F(ConvolutionTests1, TestDeconv_bp_2) { /* Input shape: @@ -775,7 +758,7 @@ TEST_F(ConvolutionTests1, TestDeconv_bp_2) { ASSERT_EQ(ND4J_STATUS_OK, result->status()); - delete result;*/ + */ } TYPED_TEST(TypedConvolutionTests1, Test_Conv1D_ff_1) { auto input = NDArrayFactory::create('c', {2, 2, 6}); @@ -793,9 +776,9 @@ TYPED_TEST(TypedConvolutionTests1, Test_Conv1D_ff_1) { sd::ops::conv1d op; auto result_FF = op.evaluate({&input, &weights, &bias}, {}, {2, 1, 0, 1, 0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result_FF->status()); + ASSERT_EQ(ND4J_STATUS_OK, result_FF.status()); - auto z = result_FF->at(0); + auto z = result_FF.at(0); ASSERT_TRUE(expFF.isSameShape(z)); ASSERT_TRUE(expFF.equalsTo(z)); @@ -806,11 +789,11 @@ TYPED_TEST(TypedConvolutionTests1, Test_Conv1D_ff_1) { epsilonNxt->linspace(1); auto result_BP = op_bp.evaluate({&input, &weights, &bias, epsilonNxt}, {}, {2, 1, 0, 1, 0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result_BP->status()); + ASSERT_EQ(ND4J_STATUS_OK, result_BP.status()); - auto eps = result_BP->at(0); - auto gradW = result_BP->at(1); - auto gradB = result_BP->at(2); + auto eps = result_BP.at(0); + auto gradW = result_BP.at(1); + auto gradB = result_BP.at(2); ASSERT_TRUE(expEps.isSameShape(eps)); ASSERT_TRUE(expGW.isSameShape(gradW)); @@ -820,8 +803,6 @@ TYPED_TEST(TypedConvolutionTests1, Test_Conv1D_ff_1) { ASSERT_TRUE(expGW.equalsTo(gradW)); ASSERT_TRUE(expGB.equalsTo(gradB)); - delete result_FF; - delete result_BP; delete epsilonNxt; } @@ -835,11 +816,10 @@ TYPED_TEST(TypedConvolutionTests1, Test_Conv1D_ff_2) { sd::ops::conv1d op; auto result = op.evaluate({&input, &weights}, {}, {2, 1, 0, 1, 1,0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -861,14 +841,13 @@ TEST_F(ConvolutionTests1, conv1d_causal_1) { sd::ops::conv1d op; auto results = op.evaluate({&input, &weights, &bias}, {kW, sW, pW, dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -893,14 +872,13 @@ TEST_F(ConvolutionTests1, conv1d_causal_2) { sd::ops::conv1d op; auto results = op.evaluate({&input, &weights, &bias}, {kW, sW, pW, dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -924,14 +902,13 @@ TEST_F(ConvolutionTests1, conv1d_causal_3) { sd::ops::conv1d op; auto results = op.evaluate({&input, &weights, &bias}, {kW, sW, pW, dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -955,14 +932,13 @@ TEST_F(ConvolutionTests1, conv1d_causal_4) { sd::ops::conv1d op; auto results = op.evaluate({&input, &weights, &bias}, {kW, sW, pW, dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -986,14 +962,13 @@ TEST_F(ConvolutionTests1, conv1d_causal_5) { sd::ops::conv1d op; auto results = op.evaluate({&input, &weights, &bias}, {kW, sW, pW, dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1017,14 +992,13 @@ TEST_F(ConvolutionTests1, conv1d_causal_6) { sd::ops::conv1d op; auto results = op.evaluate({&input, &weights, &bias}, {kW, sW, pW, dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1049,14 +1023,13 @@ TEST_F(ConvolutionTests1, conv1d_causal_7) { sd::ops::conv1d op; auto results = op.evaluate({&input, &weights}, {kW, sW, pW, dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1082,14 +1055,13 @@ TEST_F(ConvolutionTests1, conv1d_causal_8) { sd::ops::conv1d op; auto results = op.evaluate({&input, &weights}, {kW, sW, pW, dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1130,14 +1102,12 @@ TEST_F(ConvolutionTests1, Test_Dilation2D_1) { sd::ops::dilation2d op; auto result = op.evaluate({&input, &weights}, {1, 1,2,2,1, 1,2,2,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } TEST_F(ConvolutionTests1, Test_Dilation2D_2) { @@ -1150,14 +1120,13 @@ TEST_F(ConvolutionTests1, Test_Dilation2D_2) { sd::ops::dilation2d op; auto result = op.evaluate({&input, &weights}, {0, 1,2,2,1, 1,2,2,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -1189,10 +1158,10 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_bp_test1) { sd::ops::conv2d_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto gradI = results->at(0); - auto gradW = results->at(1); + auto gradI = results.at(0); + auto gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -1200,7 +1169,6 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_bp_test1) { ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1232,18 +1200,16 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_bp_test2) { sd::ops::conv2d_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto gradI = results->at(0); - auto gradW = results->at(1); + auto gradI = results.at(0); + auto gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1277,11 +1243,11 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_bp_test3) { sd::ops::conv2d_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto gradI = results->at(0); - auto gradW = results->at(1); - auto gradB = results->at(2); + auto gradI = results.at(0); + auto gradW = results.at(1); + auto gradB = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -1292,7 +1258,7 @@ TYPED_TEST(TypedConvolutionTests1, conv2d_bp_test3) { ASSERT_TRUE(expGradB.isSameShape(gradB)); ASSERT_TRUE(expGradB.equalsTo(gradB)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1359,17 +1325,17 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_bp_test1) { sd::ops::conv3dnew_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto gradI = results->at(0); - auto gradW = results->at(1); + auto gradI = results.at(0); + auto gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - delete results; + } @@ -1407,17 +1373,17 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_bp_test2) { sd::ops::conv3dnew_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto gradI = results->at(0); - auto gradW = results->at(1); + auto gradI = results.at(0); + auto gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - delete results; + } @@ -1460,11 +1426,11 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_bp_test3) { sd::ops::conv3dnew_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* gradI = results->at(0); - auto* gradW = results->at(1); - auto* gradB = results->at(2); + auto* gradI = results.at(0); + auto* gradW = results.at(1); + auto* gradB = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -1475,7 +1441,7 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_bp_test3) { ASSERT_TRUE(expGradB.isSameShape(gradB)); ASSERT_TRUE(expGradB.equalsTo(gradB)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1503,10 +1469,10 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test1) { sd::ops::depthwise_conv2d_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* gradI = results->at(0); - auto* gradW = results->at(1); + auto* gradI = results.at(0); + auto* gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -1514,7 +1480,6 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test1) { ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1541,10 +1506,10 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test2) { sd::ops::depthwise_conv2d_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* gradI = results->at(0); - auto* gradW = results->at(1); + auto* gradI = results.at(0); + auto* gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -1552,7 +1517,6 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test2) { ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1607,12 +1571,12 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test4) { NDArray expGradB('c', {oC}, {-2960., -2970., -2980., -2990., -3000., -3010., -3020., -3030.}, sd::DataType::FLOAT32); sd::ops::depthwise_conv2d_bp op; - ResultSet* results = op.evaluate({&input, &weights, &bias, &gradO}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - NDArray* gradI = results->at(0); - NDArray* gradW = results->at(1); - NDArray* gradB = results->at(2); + auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); + NDArray* gradI = results.at(0); + NDArray* gradW = results.at(1); + NDArray* gradB = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -1623,7 +1587,6 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test4) { ASSERT_TRUE(expGradB.isSameShape(gradB)); ASSERT_TRUE(expGradB.equalsTo(gradB)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1662,12 +1625,12 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test5) { NDArray expGradB('c', {oC}, {505., -495., -1495., -2495., -3495., -4494.999512, -5495., -6495.}, sd::DataType::FLOAT32); sd::ops::depthwise_conv2d_bp op; - ResultSet* results = op.evaluate({&input, &weights, &bias, &gradO}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - NDArray* gradI = results->at(0); - NDArray* gradW = results->at(1); - NDArray* gradB = results->at(2); + auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); + NDArray* gradI = results.at(0); + NDArray* gradW = results.at(1); + NDArray* gradB = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -1678,7 +1641,6 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test5) { ASSERT_TRUE(expGradB.isSameShape(gradB)); ASSERT_TRUE(expGradB.equalsTo(gradB)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1707,10 +1669,10 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test6) { sd::ops::depthwise_conv2d_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* gradI = results->at(0); - auto* gradW = results->at(1); + auto* gradI = results.at(0); + auto* gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -1718,7 +1680,6 @@ TEST_F(ConvolutionTests1, depthwise_conv2d_bp_test6) { ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1743,13 +1704,12 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test1) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1775,13 +1735,12 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test2) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1802,13 +1761,12 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test3) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1828,13 +1786,12 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test4) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -1856,15 +1813,14 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test5) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights, &bias}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); // output->printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -1885,15 +1841,14 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test6) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights, &bias}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); // output->printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -1916,15 +1871,15 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test7) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights, &bias}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); // output->printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1945,13 +1900,13 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test8) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1962,13 +1917,11 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test9) { sd::ops::conv3dnew op; auto result = op.evaluate({&x, &y}, {}, {2,5,5, 5,4,3, 0,0,0, 1,1,1, 1,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); - - delete result; } TYPED_TEST(TypedConvolutionTests1, conv3d_test10) { @@ -1978,7 +1931,7 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test10) { sd::ops::conv3dnew op; auto result = op.evaluate({&x, &w}, {}, {2,5,5, 5,4,3, 0,0,0, 1,1,1, 1,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ShapeList shapeList({x.shapeInfo(), w.shapeInfo()}); ContextPrototype proto; @@ -2007,13 +1960,11 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test10) { auto s = shapes->at(0); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z shape"); ASSERT_TRUE(exp.isSameShape(z)); - delete result; - shapes->destroy(); delete shapes; } @@ -2040,13 +1991,12 @@ TYPED_TEST(TypedConvolutionTests1, pointwise_conv2d_test1) { sd::ops::pointwise_conv2d op; auto results = op.evaluate({&input, &weights, &bias}, {}, {dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2064,11 +2014,10 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test11) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2088,12 +2037,11 @@ TYPED_TEST(TypedConvolutionTests1, conv3d_test12) { sd::ops::conv3dnew op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(output->isSameShape(&expected)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2206,13 +2154,12 @@ TEST_F(ConvolutionTests1, upsampling2d_test1) { sd::ops::upsampling2d op; auto results = op.evaluate({&input}, {factorH, factorW, isNCHW}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2234,14 +2181,13 @@ TEST_F(ConvolutionTests1, upsampling2d_test2) { sd::ops::upsampling2d op; auto results = op.evaluate({&input}, {factorH, factorW, isNCHW}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2272,13 +2218,12 @@ TEST_F(ConvolutionTests1, upsampling3d_test1) { sd::ops::upsampling3d op; auto results = op.evaluate({&input}, {factorD, factorH, factorW, isNCDHW}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2306,14 +2251,13 @@ TEST_F(ConvolutionTests1, upsampling3d_test2) { sd::ops::upsampling3d op; auto results = op.evaluate({&input}, {factorD, factorH, factorW, isNCDHW}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } @@ -2333,13 +2277,11 @@ TEST_F(ConvolutionTests1, upsampling3d_bp_test1) { sd::ops::upsampling3d_bp op; auto results = op.evaluate({&input, &gradO}, {isNCDHW}); - auto* gradI = results->at(0); + auto* gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); - - delete results; } TYPED_TEST(TypedConvolutionTests1, conv2D_input_BP_test1) { @@ -2361,14 +2303,13 @@ TYPED_TEST(TypedConvolutionTests1, conv2D_input_BP_test1) { auto results = op.evaluate({&inputShape, &weights, &epsilonNext}, {}, {3, 3, 1, 1, 0, 0, 1, 1, 1}); - ASSERT_TRUE(results->size() == 1); + ASSERT_TRUE(results.size() == 1); - auto epsilon = results->at(0); + auto epsilon = results.at(0); ASSERT_TRUE(shapeArr.isSameShape(epsilon)); ASSERT_TRUE(expEps.equalsTo(epsilon)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2425,13 +2366,12 @@ TEST_F(ConvolutionTests1, upsampling3d_bp_test3) { sd::ops::upsampling3d_bp op; auto results = op.evaluate({&input, &gradO}, {isNCDHW}); - auto* gradI = results->at(0); + auto* gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); - delete results; } @@ -2458,14 +2398,13 @@ TEST_F(ConvolutionTests1, deconv2d_test1) { sd::ops::deconv2d op; auto results = op.evaluate({&input, &weights}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2491,13 +2430,12 @@ TEST_F(ConvolutionTests1, deconv2d_test2) { sd::ops::deconv2d op; auto results = op.evaluate({&input, &weights}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2523,14 +2461,13 @@ TEST_F(ConvolutionTests1, deconv2d_test3) { sd::ops::deconv2d op; auto results = op.evaluate({&input, &weights}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2559,14 +2496,13 @@ TEST_F(ConvolutionTests1, deconv2d_test4) { sd::ops::deconv2d op; auto result = op.evaluate({&input, &weights}, {5, 5, 1, 1, 0, 0, 1, 1, 0, 0}); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo(); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -2617,14 +2553,13 @@ TYPED_TEST(TypedConvolutionTests1, deconv2d_test6) { sd::ops::deconv2d op; auto results = op.evaluate({&input, &weights}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } TEST_F(ConvolutionTests1, deconv2d_test7) { @@ -2642,14 +2577,12 @@ TEST_F(ConvolutionTests1, deconv2d_test7) { auto result = op.evaluate({&input, &weights, &bias}, {1, 1, 1, 1, 0, 0, 1, 1, 1, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete result; } ////////////////////////////////////////////////////////////////////// @@ -2685,14 +2618,13 @@ TEST_F(ConvolutionTests1, deconv2d_test8) { sd::ops::deconv2d op; auto results = op.evaluate({&input, &weights, &bias}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2719,13 +2651,12 @@ TYPED_TEST(TypedConvolutionTests1, deconv2d_tf_test1) { sd::ops::deconv2d_tf op; auto results = op.evaluate({&outShape, &weights, &input}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } diff --git a/libnd4j/tests_cpu/layers_tests/ConvolutionTests2.cpp b/libnd4j/tests_cpu/layers_tests/ConvolutionTests2.cpp index e403f6a32..2c3351175 100644 --- a/libnd4j/tests_cpu/layers_tests/ConvolutionTests2.cpp +++ b/libnd4j/tests_cpu/layers_tests/ConvolutionTests2.cpp @@ -80,14 +80,13 @@ TEST_F(ConvolutionTests2, im2col_1) { sd::ops::im2col op; auto results = op.evaluate({&image}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode}); - auto column = results->at(0); + auto column = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(column)); ASSERT_TRUE(expected.equalsTo(column)); - delete results; } template @@ -123,13 +122,12 @@ TYPED_TEST(TypedConvolutionTests2, deconv2d_tf_test2) { sd::ops::deconv2d_tf op; auto results = op.evaluate({&outShape, &weights, &input}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -141,11 +139,10 @@ TYPED_TEST(TypedConvolutionTests2, Test_DeConv2D_TF_1) { sd::ops::deconv2d_tf op; auto result = op.evaluate({&input0, &input1, &input2}, {}, {2, 2, 1, 1, 0, 0, 1, 1, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(exp, *result->at(0)); + ASSERT_EQ(exp, *result.at(0)); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -171,14 +168,13 @@ TYPED_TEST(TypedConvolutionTests2, Test_DeConv2D_TF_2) { sd::ops::deconv2d_tf op; auto result = op.evaluate({&input0, &input1, &input2}, {}, {7,7, 2,2, 0,0, 1,1, 1,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -190,13 +186,11 @@ TEST_F(ConvolutionTests2, Test_Dilation2D_Again_1) { sd::ops::dilation2d op; auto result = op.evaluate({&x, &w}, {}, {1, 1,5,7,1, 1,2,3,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - - delete result; } ////////////////////////////////////////////////////////////////////// @@ -206,9 +200,8 @@ TEST_F(ConvolutionTests2, Test_Dilation2D_Again_2) { sd::ops::dilation2d op; auto result = op.evaluate({&x, &w}, {}, {0, 1,2,3,1, 1,3,2,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; } TYPED_TEST(TypedConvolutionTests2, sconv2d_bp_1) { @@ -248,11 +241,11 @@ TYPED_TEST(TypedConvolutionTests2, sconv2d_bp_1) { sd::ops::sconv2d_bp op; auto resultBP = op.evaluate({&input, &epsilonNext, &weightsD, &weightsP },{}, {5, 5, 1, 1, 0, 0, 1, 1, 0}, {}); - ASSERT_EQ(3, resultBP->size()); + ASSERT_EQ(3, resultBP.size()); - auto _epsilon = resultBP->at(0); - auto _gradWD = resultBP->at(1); - auto _gradWP = resultBP->at(2); + auto _epsilon = resultBP.at(0); + auto _gradWD = resultBP.at(1); + auto _gradWP = resultBP.at(2); //_gradWP->printBuffer("gradWP"); @@ -273,7 +266,6 @@ TYPED_TEST(TypedConvolutionTests2, sconv2d_bp_1) { ASSERT_TRUE(_epsilon->equalsTo(&expE)); - delete resultBP; } ////////////////////////////////////////////////////////////////////// @@ -344,14 +336,12 @@ TYPED_TEST(TypedConvolutionTests2, sconv2d_bp_3) { sd::ops::sconv2d_bp op; auto result = op.evaluate({&input, &epsilonNext, &weightsD, &weightsP}, {}, {2, 2, 1, 1, 0, 0, 2, 2, 0}); - auto eps = result->at(0); - auto gWD = result->at(1); - auto gWP = result->at(2); + auto eps = result.at(0); + auto gWD = result.at(1); + auto gWP = result.at(2); ASSERT_TRUE(epsilon.isSameShape(eps)); - - delete result; } ////////////////////////////////////////////////////////////////////// @@ -379,10 +369,10 @@ TYPED_TEST(TypedConvolutionTests2, sconv2d_bp_4) { sd::ops::sconv2d_bp op; auto results = op.evaluate({&input, &gradO, &weightsDepth, &bias}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* gradI = results->at(0); - auto* gradWD = results->at(1); + auto* gradI = results.at(0); + auto* gradWD = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -390,7 +380,6 @@ TYPED_TEST(TypedConvolutionTests2, sconv2d_bp_4) { ASSERT_TRUE(expGradW.isSameShape(gradWD)); ASSERT_TRUE(expGradW.equalsTo(gradWD)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -464,15 +453,14 @@ TEST_F(ConvolutionTests2, deconv3d_test1) { sd::ops::deconv3d op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}, {}); - auto output = results->at(0); + auto output = results.at(0); // output->printBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -498,13 +486,12 @@ TEST_F(ConvolutionTests2, deconv3d_test2) { sd::ops::deconv3d op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -531,13 +518,12 @@ TEST_F(ConvolutionTests2, deconv3d_test3) { sd::ops::deconv3d op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -558,13 +544,12 @@ TEST_F(ConvolutionTests2, deconv3d_test4) { sd::ops::deconv3d op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -601,14 +586,13 @@ TEST_F(ConvolutionTests2, deconv3d_test5) { sd::ops::deconv3d op; auto results = op.evaluate({&input, &weights}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -635,11 +619,11 @@ TEST_F(ConvolutionTests2, deconv3d_bp_test1) { sd::ops::deconv3d_bp op; auto results = op.evaluate({&input, &weights, &bias, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}, {}); - auto gradI = results->at(0); - auto gradW = results->at(1); - auto gradB = results->at(2); + auto gradI = results.at(0); + auto gradW = results.at(1); + auto gradB = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -650,8 +634,7 @@ TEST_F(ConvolutionTests2, deconv3d_bp_test1) { ASSERT_TRUE(expGradB.isSameShape(gradB)); ASSERT_TRUE(expGradB.equalsTo(gradB)); - delete results; -} + } ////////////////////////////////////////////////////////////////////// TEST_F(ConvolutionTests2, deconv3d_bp_test2) { @@ -675,10 +658,10 @@ TEST_F(ConvolutionTests2, deconv3d_bp_test2) { sd::ops::deconv3d_bp op; auto results = op.evaluate({&input, &weights, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}, {}); - auto gradI = results->at(0); - auto gradW = results->at(1); + auto gradI = results.at(0); + auto gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -686,7 +669,6 @@ TEST_F(ConvolutionTests2, deconv3d_bp_test2) { ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -710,10 +692,10 @@ TEST_F(ConvolutionTests2, deconv3d_bp_test3) { sd::ops::deconv3d_bp op; auto results = op.evaluate({&input, &weights, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}, {}); - auto gradI = results->at(0); - auto gradW = results->at(1); + auto gradI = results.at(0); + auto gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); @@ -721,7 +703,6 @@ TEST_F(ConvolutionTests2, deconv3d_bp_test3) { ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -745,18 +726,16 @@ TEST_F(ConvolutionTests2, deconv3d_bp_test4) { sd::ops::deconv3d_bp op; auto results = op.evaluate({&input, &weights, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, dataFormat}, {}); - auto gradI = results->at(0); - auto gradW = results->at(1); + auto gradI = results.at(0); + auto gradW = results.at(1); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); ASSERT_TRUE(expGradW.isSameShape(gradW)); ASSERT_TRUE(expGradW.equalsTo(gradW)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -780,7 +759,7 @@ TEST_F(ConvolutionTests2, maxpool2d_1) { ASSERT_EQ(ND4J_STATUS_OK, status); auto result = variableSpace->getVariable(block->getNodeId())->getNDArray(); - // result->printShapeInfo(); + // result.printShapeInfo(); ASSERT_TRUE(exp.isSameShape(result)); delete variableSpace; @@ -824,7 +803,7 @@ TEST_F(ConvolutionTests2, maxpool2d_2) { ASSERT_EQ(ND4J_STATUS_OK, status); auto result = variableSpace->getVariable(block->getNodeId())->getNDArray(); - // result->printShapeInfo(); + // result.printShapeInfo(); ASSERT_TRUE(exp.isSameShape(result)); delete variableSpace; @@ -868,7 +847,7 @@ TEST_F(ConvolutionTests2, maxpool2d_3) { ASSERT_EQ(ND4J_STATUS_OK, status); auto result = variableSpace->getVariable(block->getNodeId())->getNDArray(); - // result->printShapeInfo(); + // result.printShapeInfo(); ASSERT_TRUE(exp.isSameShape(result)); delete variableSpace; @@ -912,7 +891,7 @@ TEST_F(ConvolutionTests2, maxpool2d_4) { ASSERT_EQ(ND4J_STATUS_OK, status); auto result = variableSpace->getVariable(block->getNodeId())->getNDArray(); - // result->printShapeInfo(); + // result.printShapeInfo(); ASSERT_TRUE(exp.isSameShape(result)); delete variableSpace; @@ -956,7 +935,7 @@ TEST_F(ConvolutionTests2, maxpool2d_5) { ASSERT_EQ(ND4J_STATUS_OK, status); auto result = variableSpace->getVariable(block->getNodeId())->getNDArray(); - // result->printShapeInfo(); + // result.printShapeInfo(); ASSERT_TRUE(exp.isSameShape(result)); delete variableSpace; @@ -973,14 +952,13 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_6) { sd::ops::maxpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -993,14 +971,13 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_7) { sd::ops::maxpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 0, 0, 1, 1, 0, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -1013,14 +990,12 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_8) { sd::ops::maxpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 0, 0, 1, 1, 0, 1, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////// @@ -1042,12 +1017,11 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_9) { sd::ops::maxpool2d op; auto results = op.evaluate({&input}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, isSameMode, 1, 0}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(output->isSameShape({bS, iC, oH, oW})); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1069,14 +1043,12 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_10) { sd::ops::maxpool2d op; auto results = op.evaluate({&input}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1090,9 +1062,8 @@ TEST_F(ConvolutionTests2, maxpool2d_11) { sd::ops::maxpool2d op; auto results = op.evaluate({&input}, {}, {2,2, 1,1, 1,1, 2,2, 1,0,0}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1111,13 +1082,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool3d_test1) { sd::ops::avgpool3dnew op; auto results = op.evaluate({&input}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1139,13 +1109,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool3d_test2) { sd::ops::avgpool3dnew op; auto results = op.evaluate({&input}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 0, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1164,13 +1133,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool3d_test3) { sd::ops::avgpool3dnew op; auto results = op.evaluate({&input}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1204,13 +1172,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool3d_test4) { sd::ops::avgpool3dnew op; auto results = op.evaluate({&input}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1228,13 +1195,11 @@ TYPED_TEST(TypedConvolutionTests2, maxpool3d_test1) { sd::ops::maxpool3dnew op; auto results = op.evaluate({&input}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1256,13 +1221,11 @@ TYPED_TEST(TypedConvolutionTests2, maxpool3d_test2) { sd::ops::maxpool3dnew op; auto results = op.evaluate({&input}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1280,13 +1243,12 @@ TYPED_TEST(TypedConvolutionTests2, maxpool3d_test3) { sd::ops::maxpool3dnew op; auto results = op.evaluate({&input}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1310,13 +1272,11 @@ TYPED_TEST(TypedConvolutionTests2, maxpool3d_test4) { sd::ops::maxpool3dnew op; auto results = op.evaluate({&input}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1343,13 +1303,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool3d_bp_test1) { sd::ops::avgpool3dnew_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1377,15 +1336,14 @@ TYPED_TEST(TypedConvolutionTests2, avgpool3d_bp_test2) { sd::ops::avgpool3dnew_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); // output->printBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1412,13 +1370,11 @@ TYPED_TEST(TypedConvolutionTests2, avgpool3d_bp_test3) { sd::ops::avgpool3dnew_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 0, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1444,13 +1400,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool3d_bp_test4) { sd::ops::avgpool3dnew_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 0, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1475,13 +1430,11 @@ TYPED_TEST(TypedConvolutionTests2, maxpool3d_bp_test1) { sd::ops::maxpool3dnew_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1508,13 +1461,11 @@ TYPED_TEST(TypedConvolutionTests2, maxpool3d_bp_test2) { sd::ops::maxpool3dnew_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1540,13 +1491,12 @@ TYPED_TEST(TypedConvolutionTests2, maxpool3d_bp_test3) { sd::ops::maxpool3dnew_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1572,13 +1522,12 @@ TYPED_TEST(TypedConvolutionTests2, maxpool3d_bp_test4) { sd::ops::maxpool3dnew_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kD,kH,kW, sD,sH,sW, pD,pH,pW, dD,dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1631,12 +1580,11 @@ TEST_F(ConvolutionTests2, maxpool2d_bp_2) { sd::ops::maxpool2d_bp op; auto results = op.evaluate({&input, &epsilon}, {}, argI); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1657,13 +1605,11 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_bp_3) { sd::ops::maxpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1684,13 +1630,12 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_bp_4) { sd::ops::maxpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1711,13 +1656,12 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_bp_5) { sd::ops::maxpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1738,13 +1682,12 @@ TYPED_TEST(TypedConvolutionTests2, maxpool2d_bp_6) { sd::ops::maxpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1763,13 +1706,12 @@ TEST_F(ConvolutionTests2, maxpool2d_bp_7) { sd::ops::maxpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 1, dataFormat}); - // auto output = results->at(0); + // auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); // ASSERT_TRUE(expected.isSameShape(output)); // ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1821,12 +1763,11 @@ TYPED_TEST(TypedConvolutionTests2, avgpool2d_bp_2) { sd::ops::avgpool2d_bp op; auto results = op.evaluate({&input, &epsilon}, {}, argI); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -1850,13 +1791,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool2d_bp_3) { sd::ops::avgpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1881,13 +1821,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool2d_bp_4) { sd::ops::avgpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1910,13 +1849,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool2d_bp_5) { sd::ops::avgpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 0, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1939,13 +1877,12 @@ TYPED_TEST(TypedConvolutionTests2, avgpool2d_bp_6) { sd::ops::avgpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 1, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2003,13 +1940,12 @@ TYPED_TEST(TypedConvolutionTests2, pnormpool2d_bp_2) { sd::ops::pnormpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {eps}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, pnorm, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2036,13 +1972,12 @@ TYPED_TEST(TypedConvolutionTests2, pnormpool2d_bp_3) { sd::ops::pnormpool2d_bp op; auto results = op.evaluate({&input, &gradO}, {eps}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, pnorm, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -2062,13 +1997,12 @@ TEST_F(ConvolutionTests2, upsampling2d_bp_1) { sd::ops::upsampling2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {isNCHW}); - auto* gradI = results->at(0); + auto* gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2087,13 +2021,12 @@ TEST_F(ConvolutionTests2, upsampling2d_bp_2) { sd::ops::upsampling2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {isNCHW}); - auto* gradI = results->at(0); + auto* gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2118,13 +2051,12 @@ TEST_F(ConvolutionTests2, upsampling2d_bp_3) { sd::ops::upsampling2d_bp op; auto results = op.evaluate({&input, &gradO}, {}, {isNCHW}); - auto* gradI = results->at(0); + auto* gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expGradI.isSameShape(gradI)); ASSERT_TRUE(expGradI.equalsTo(gradI)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2149,14 +2081,12 @@ TYPED_TEST(TypedConvolutionTests2, depthwise_conv2d_1) { sd::ops::depthwise_conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2179,14 +2109,13 @@ TEST_F(ConvolutionTests2, depthwise_conv2d_2) { sd::ops::depthwise_conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } @@ -2211,14 +2140,13 @@ TEST_F(ConvolutionTests2, depthwise_conv2d_3) { sd::ops::depthwise_conv2d op; auto results = op.evaluate({&input, &weights, &biases}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2268,14 +2196,13 @@ TEST_F(ConvolutionTests2, depthwise_conv2d_5) { sd::ops::depthwise_conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2296,15 +2223,14 @@ TEST_F(ConvolutionTests2, depthwise_conv2d_6) { sd::ops::depthwise_conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - NDArray* output = results->at(0); + NDArray* output = results.at(0); // output.printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2331,14 +2257,13 @@ TEST_F(ConvolutionTests2, depthwise_conv2d_7) { sd::ops::depthwise_conv2d op; auto results = op.evaluate({&input, &weights, &biases}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto* output = results->at(0); + auto* output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2369,15 +2294,13 @@ TEST_F(ConvolutionTests2, depthwise_conv2d_8) { sd::ops::depthwise_conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); // output->printBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output)); - - delete results; } ////////////////////////////////////////////////////////////////////// @@ -2409,14 +2332,13 @@ TEST_F(ConvolutionTests2, depthwise_conv2d_9) { sd::ops::depthwise_conv2d op; auto results = op.evaluate({&input, &weights}, {}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(output)); ASSERT_TRUE(expOutput.equalsTo(output, 1e-4)); - delete results; } #endif //LIBND4J_CONVOLUTIONTESTS2_H \ No newline at end of file diff --git a/libnd4j/tests_cpu/layers_tests/DataTypesValidationTests.cpp b/libnd4j/tests_cpu/layers_tests/DataTypesValidationTests.cpp index 830b861a4..83f3a15f5 100644 --- a/libnd4j/tests_cpu/layers_tests/DataTypesValidationTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/DataTypesValidationTests.cpp @@ -48,9 +48,7 @@ TEST_F(DataTypesValidationTests, Basic_Test_1) { sd::ops::conv2d op; auto result = op.evaluate({&input, &weights}, {1, 1, 1, 1, 0, 0, 1, 1, 0, 0}); - ASSERT_EQ(ND4J_STATUS_VALIDATION, result->status()); - - delete result; + ASSERT_EQ(ND4J_STATUS_VALIDATION, result.status()); } TEST_F(DataTypesValidationTests, Basic_Test_2) { @@ -63,13 +61,12 @@ TEST_F(DataTypesValidationTests, Basic_Test_2) { sd::ops::conv2d op; auto result = op.evaluate({&input, &weights}, {1, 1, 1, 1, 0, 0, 1, 1, 0, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests1.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests1.cpp index 60076f7d6..28240cc10 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests1.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests1.cpp @@ -162,11 +162,11 @@ TEST_F(DeclarableOpsTests1, ApplyGradientDescent_1) { exp.linspace(0.9, 0.9); sd::ops::apply_sgd op; auto result = op.evaluate({ &x, &y }, { 1. }, {}); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - auto z = result->at(0); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + auto z = result.at(0); ASSERT_TRUE(z->equalsTo(exp)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -176,11 +176,11 @@ TEST_F(DeclarableOpsTests1, AssignBroadcastTest_1) { auto exp = NDArrayFactory::create('c', { 3,4 }, { 0.1, 0.2, 0.3, 0.4, 0.1, 0.2, 0.3, 0.4, 0.1, 0.2, 0.3, 0.4 }); sd::ops::assign op; auto result = op.evaluate({ &x, &y }); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - auto z = result->at(0); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + auto z = result.at(0); ASSERT_TRUE(z->equalsTo(exp)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -192,13 +192,13 @@ TEST_F(DeclarableOpsTests1, AssignBroadcastTest_2) { auto exp2 = NDArrayFactory::create('c', { 1,4 }, { 3, 6, 9, 12 }); sd::ops::assign_bp op; auto result = op.evaluate({ &x, &y, &eps }); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - auto z1 = result->at(0); - auto z2 = result->at(1); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + auto z1 = result.at(0); + auto z2 = result.at(1); ASSERT_TRUE(z1->equalsTo(exp1)); ASSERT_TRUE(z2->equalsTo(exp2)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -209,11 +209,11 @@ TEST_F(DeclarableOpsTests1, AXpY_Test_1) { exp.linspace(3, 3); sd::ops::axpy op; auto result = op.evaluate({ &x, &y }, { 2. }); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - auto z = result->at(0); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + auto z = result.at(0); ASSERT_TRUE(z->equalsTo(exp)); - delete result; + } TEST_F(DeclarableOpsTests1, BasicInitialization3) { @@ -251,14 +251,14 @@ TEST_F(DeclarableOpsTests1, TestTensorMmul1) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,1,2,2,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* out = results->at(0); + auto* out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } TEST_F(DeclarableOpsTests1, TestTensorDot2) { @@ -271,14 +271,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot2) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,1,2,2,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* out = results->at(0); + auto* out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } TEST_F(DeclarableOpsTests1, TestTensorDot3) { @@ -291,14 +291,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot3) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,1,2,2,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* out = results->at(0); + auto* out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } TEST_F(DeclarableOpsTests1, TestTensorDot4) { @@ -311,14 +311,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot4) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,1,2,2,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* out = results->at(0); + auto* out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -331,14 +331,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot5) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 1,1,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -353,14 +353,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot6) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 1,1,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -374,14 +374,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot7) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 1,1,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -395,14 +395,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot8) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 1,1,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -424,14 +424,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot9) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 1,0,1,0 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -445,14 +445,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot10) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,0,1, 2,0,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -467,14 +467,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot11) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,0,1, 2,0,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -488,14 +488,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot12) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,0,1, 2,0,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -509,14 +509,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot13) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,0,2, 2,1,0 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -530,14 +530,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot14) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,0,2, 2,1,0 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -551,14 +551,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot15) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 2,0,2, 2,1,0 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -572,14 +572,14 @@ TEST_F(DeclarableOpsTests1, TestTensorDot16) { sd::ops::tensormmul op; auto results = op.evaluate({ &x, &y }, {}, { 1,0, 1,1 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* result = results->at(0); + auto* result = results.at(0); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -782,11 +782,11 @@ TEST_F(DeclarableOpsTests1, SubtractTest_2) { auto res = subOp.evaluate({ &x, &y }); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(&exp)); + ASSERT_TRUE(res.at(0)->equalsTo(&exp)); - delete res; + } TEST_F(DeclarableOpsTests1, TestRng1) { @@ -1043,10 +1043,10 @@ TEST_F(DeclarableOpsTests1, ReverseSubtractTest_1) { auto res = subOp.evaluate({ &x, &y }); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(&exp)); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + ASSERT_TRUE(res.at(0)->equalsTo(&exp)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1068,10 +1068,10 @@ TEST_F(DeclarableOpsTests1, ReverseSubtractTest_2) { auto res = subOp.evaluate({ &x, &y }); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(&exp)); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + ASSERT_TRUE(res.at(0)->equalsTo(&exp)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1090,10 +1090,10 @@ TEST_F(DeclarableOpsTests1, ReverseSubtractTest_3) { sd::ops::reversesubtract subOp; auto res = subOp.evaluate({ &x, &y }); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(&exp)); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + ASSERT_TRUE(res.at(0)->equalsTo(&exp)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1117,11 +1117,11 @@ TEST_F(DeclarableOpsTests1, ReverseModTest_1) { auto res = subOp.evaluate({ &x, &y }); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(&exp)); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + ASSERT_TRUE(res.at(0)->equalsTo(&exp)); ASSERT_TRUE(exp.equalsTo(&z)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1144,10 +1144,10 @@ TEST_F(DeclarableOpsTests1, ReverseModTest_2) { auto res = subOp.evaluate({ &x, &y }); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(&exp)); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + ASSERT_TRUE(res.at(0)->equalsTo(&exp)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1399,10 +1399,10 @@ TEST_F(DeclarableOpsTests1, BroadcastDivideTest_1) { auto res = div.evaluate({ &x, &y }); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(exp)); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + ASSERT_TRUE(res.at(0)->equalsTo(exp)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1418,10 +1418,10 @@ TEST_F(DeclarableOpsTests1, BroadcastDivideTest_2) { sd::ops::divide_no_nan div; auto res = div.evaluate({ &x, &y }); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(exp)); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + ASSERT_TRUE(res.at(0)->equalsTo(exp)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1434,10 +1434,10 @@ TEST_F(DeclarableOpsTests1, BroadcastDivideTest_3) { sd::ops::divide_no_nan div; auto res = div.evaluate({ &x, &y }); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(exp)); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + ASSERT_TRUE(res.at(0)->equalsTo(exp)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1454,16 +1454,16 @@ TEST_F(DeclarableOpsTests1, BroadcastReverseDivideTest_1) { auto res = div.evaluate({ &x, &y }); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); - ASSERT_TRUE(res->at(0)->equalsTo(exp)); + ASSERT_TRUE(res.at(0)->equalsTo(exp)); auto z(exp); x.applyTrueBroadcast(BROADCAST(ReverseDivide), y, z, true); y.applyTrueBroadcast(BROADCAST(Divide), x, exp, true); ASSERT_TRUE(z.equalsTo(&exp)); - delete res; + } ////////////////////////////////////////////////////////////////////// @@ -1710,12 +1710,12 @@ TEST_F(DeclarableOpsTests1, Test_Cast_1) { sd::ops::cast op; auto result = op.evaluate({ &x }, {}, { 3 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(yExp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1887,13 +1887,13 @@ TEST_F(DeclarableOpsTests1, Reshape3) { sd::ops::reshape op; auto result = op.evaluate({ &x }, {}, { -99, 3, 4, 5 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x.isSameShape(z)); - delete result; + } TEST_F(DeclarableOpsTests1, Reshape4) { @@ -1902,13 +1902,13 @@ TEST_F(DeclarableOpsTests1, Reshape4) { sd::ops::reshape op; auto result = op.evaluate({ &x }, {}, { 3, 4, 5 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x.isSameShape(z)); - delete result; + } TEST_F(DeclarableOpsTests1, Reshape5) { @@ -1917,9 +1917,9 @@ TEST_F(DeclarableOpsTests1, Reshape5) { sd::ops::reshape op; auto result = op.evaluate({ &x }, {}, { 5, 4, 3 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - delete result; + } TEST_F(DeclarableOpsTests1, Reshape6) { @@ -1929,13 +1929,13 @@ TEST_F(DeclarableOpsTests1, Reshape6) { sd::ops::reshape op; auto result = op.evaluate({ &x }, {}, { 4, -1 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isSameShape(exp)); - delete result; + } @@ -1946,13 +1946,13 @@ TEST_F(DeclarableOpsTests1, Reshape7) { sd::ops::reshape op; auto result = op.evaluate({ &x }, {}, { -1 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isSameShape(exp)); - delete result; + } @@ -2253,13 +2253,13 @@ TEST_F(DeclarableOpsTests1, IsMax1) { sd::ops::ismax ismaxOp; auto result = ismaxOp.evaluate({ &x }, {}, { 1 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto res = result->at(0); + auto res = result.at(0); //res->printIndexedBuffer("IS_MAX"); ASSERT_TRUE(exp.equalsTo(res)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -2275,13 +2275,13 @@ TEST_F(DeclarableOpsTests1, IsMax2) { sd::ops::ismax ismaxOp; auto result = ismaxOp.evaluate({ &x }, {}, { 0, 1 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto res = result->at(0); + auto res = result.at(0); //res->printIndexedBuffer("IS_MAX"); ASSERT_TRUE(exp.equalsTo(res)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -2297,13 +2297,13 @@ TEST_F(DeclarableOpsTests1, IsMax3) { sd::ops::ismax ismaxOp; auto result = ismaxOp.evaluate({ &x }, {}, { 0 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto res = result->at(0); + auto res = result.at(0); //res->printIndexedBuffer("IS_MAX"); ASSERT_TRUE(exp.equalsTo(res)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -2342,17 +2342,17 @@ TEST_F(DeclarableOpsTests1, IsMax4) { // sd::ops::sru_old op; // auto results = op.execute({&input, &weights, &bias, &init, &mask}, {}, {}); -// ASSERT_TRUE(results->size() == 2); +// ASSERT_TRUE(results.size() == 2); -// auto state = results->at(0); -// auto output = results->at(1); +// auto state = results.at(0); +// auto output = results.at(1); // // state->printBuffer(); // // expState.printIndexedBuffer("EXP STATE"); // // state->printIndexedBuffer("OUT STATE"); // ASSERT_TRUE(expState.equalsTo(state)); // ASSERT_TRUE(expOut.equalsTo(output)); -// delete results; +// // } ////////////////////////////////////////////////////////////////// @@ -2378,15 +2378,15 @@ TEST_F(DeclarableOpsTests1, sru_test1) { sd::ops::sru op; auto results = op.evaluate({ &input, &weights, &bias, &init, &mask }); - ASSERT_TRUE(results->size() == 2); + ASSERT_TRUE(results.size() == 2); - auto output = results->at(0); - auto state = results->at(1); + auto output = results.at(0); + auto state = results.at(1); ASSERT_TRUE(expState.equalsTo(state)); ASSERT_TRUE(expOut.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2425,12 +2425,12 @@ TEST_F(DeclarableOpsTests1, sru_bp) { sd::ops::sru_bp bp; auto resultsBP = bp.evaluate({ &input, &weights, &bias, &init, &state, &inGradCt, &inGradH, &mask }, {}, {}); - ASSERT_TRUE(resultsBP->size() == 4); + ASSERT_TRUE(resultsBP.size() == 4); - auto gradX = resultsBP->at(0); - auto gradW = resultsBP->at(1); - auto gradB = resultsBP->at(2); - auto gradInit = resultsBP->at(3); + auto gradX = resultsBP.at(0); + auto gradW = resultsBP.at(1); + auto gradB = resultsBP.at(2); + auto gradInit = resultsBP.at(3); // expGradX.printBuffer("Exp GRAD"); // gradX->printBuffer("Res GRAD"); ASSERT_TRUE(expGradX.equalsTo(gradX, 1e-4)); @@ -2438,7 +2438,7 @@ TEST_F(DeclarableOpsTests1, sru_bp) { ASSERT_TRUE(expGradB.equalsTo(gradB)); ASSERT_TRUE(expGradInit.equalsTo(gradInit)); - delete resultsBP; + } ////////////////////////////////////////////////////////////////// @@ -2464,17 +2464,17 @@ TEST_F(DeclarableOpsTests1, sru_bi_1) { sd::ops::sru_bi op; auto results = op.evaluate({ &input, &weights, &bias, &init, &mask }, {}, {}); - ASSERT_TRUE(results->size() == 2); + ASSERT_TRUE(results.size() == 2); - auto output = results->at(0); - auto state = results->at(1); + auto output = results.at(0); + auto state = results.at(1); // state->printBuffer(); // output->printBuffer(); ASSERT_TRUE(expState.equalsTo(state)); ASSERT_TRUE(expOut.equalsTo(output)); - delete results; + } TEST_F(DeclarableOpsTests1, sru_bi_bp_1) { @@ -2515,19 +2515,19 @@ TEST_F(DeclarableOpsTests1, sru_bi_bp_1) { sd::ops::sru_bi_bp bp; auto resultsBP = bp.evaluate({ &input, &weights, &bias, &init, &state, &inGradCt, &inGradH, &mask }, {}, {}); - ASSERT_TRUE(resultsBP->size() == 4); + ASSERT_TRUE(resultsBP.size() == 4); - auto gradX = resultsBP->at(0); - auto gradW = resultsBP->at(1); - auto gradB = resultsBP->at(2); - auto gradInit = resultsBP->at(3); + auto gradX = resultsBP.at(0); + auto gradW = resultsBP.at(1); + auto gradB = resultsBP.at(2); + auto gradInit = resultsBP.at(3); ASSERT_TRUE(expGradX.equalsTo(gradX)); ASSERT_TRUE(expGradW.equalsTo(gradW)); ASSERT_TRUE(expGradB.equalsTo(gradB)); ASSERT_TRUE(expGradInit.equalsTo(gradInit)); - delete resultsBP; + } TEST_F(DeclarableOpsTests1, ArgMax1) { @@ -2540,14 +2540,14 @@ TEST_F(DeclarableOpsTests1, ArgMax1) { auto result = op.evaluate({ &x }, {}, { 1 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -2561,14 +2561,14 @@ TEST_F(DeclarableOpsTests1, ArgMax2) { auto result = op.evaluate({ &x }, {}, { 0 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -2583,14 +2583,14 @@ TEST_F(DeclarableOpsTests1, ArgMax3) { auto result = op.evaluate({ &x, &dim }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests1, ArgMax4) { @@ -2604,14 +2604,14 @@ TEST_F(DeclarableOpsTests1, ArgMax4) { auto result = op.evaluate({ &x, &dim }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -2626,14 +2626,14 @@ TEST_F(DeclarableOpsTests1, ArgMax5) { auto result = op.evaluate({ &x, &dim }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests1, ArgMax6) { @@ -2645,19 +2645,16 @@ TEST_F(DeclarableOpsTests1, ArgMax6) { sd::ops::argmax op; auto expected = op.evaluate({ &x }, {}, { 2 }); - ASSERT_EQ(Status::OK(), expected->status()); - auto exp = expected->at(0); + ASSERT_EQ(Status::OK(), expected.status()); + auto exp = expected.at(0); auto result = op.evaluate({ &x, &dim }, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(*exp, *z); - - delete result; - delete expected; } @@ -2672,14 +2669,14 @@ TEST_F(DeclarableOpsTests1, ArgMin1) { auto result = op.evaluate({ &x }, {}, { 1 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -2694,13 +2691,13 @@ TEST_F(DeclarableOpsTests1, SquareTests1) { sd::ops::square op; auto result = op.evaluate({ &x }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests1, OneHotTests_1) { @@ -2712,15 +2709,15 @@ TEST_F(DeclarableOpsTests1, OneHotTests_1) { sd::ops::onehot op; auto result = op.evaluate({ &indices }, { 1.0f, 0.0f }, { -1, 3 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests1, OneHotTests_2) { @@ -2731,15 +2728,15 @@ TEST_F(DeclarableOpsTests1, OneHotTests_2) { sd::ops::onehot op; auto result = op.evaluate({ &indices }, { 1.0f, 0.0f }, { -1, 3 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests1, OneHotTests_3) { @@ -2750,16 +2747,16 @@ TEST_F(DeclarableOpsTests1, OneHotTests_3) { sd::ops::onehot op; auto result = op.evaluate({ &indices }, { 1.0f, 0.0f }, { -1, 3 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests1, OneHotTests_4) { @@ -2771,14 +2768,14 @@ TEST_F(DeclarableOpsTests1, OneHotTests_4) { sd::ops::onehot op; auto result = op.evaluate({ &indices, &depth }, { 1.0f, 0.0f }, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests1, OneHotTests_5) { @@ -2792,14 +2789,14 @@ TEST_F(DeclarableOpsTests1, OneHotTests_5) { sd::ops::onehot op; auto result = op.evaluate({ &indices, &depth, &on, &off }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests1, OneHotTests_6) { @@ -2808,11 +2805,11 @@ TEST_F(DeclarableOpsTests1, OneHotTests_6) { sd::ops::onehot op; auto result = op.evaluate({ &indices }, { 1.0, 0.0 }, { 0, 3 }); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests1, OneHotTests_7) { @@ -2821,11 +2818,11 @@ TEST_F(DeclarableOpsTests1, OneHotTests_7) { sd::ops::onehot op; auto result = op.evaluate({ &indices }, { 1.0, 0.0 }, { 0, 3 }, {}, { sd::DataType::HALF }, false); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests1, FillAs_1) { @@ -2837,13 +2834,13 @@ TEST_F(DeclarableOpsTests1, FillAs_1) { sd::ops::fill_as op; auto result = op.evaluate({ &x }, { scalar }, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_TRUE(x.isSameShape(result->at(0))); + ASSERT_TRUE(x.isSameShape(result.at(0))); - ASSERT_NEAR(scalar, result->at(0)->meanNumber().e(0), 1e-5f); + ASSERT_NEAR(scalar, result.at(0)->meanNumber().e(0), 1e-5f); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -2860,16 +2857,16 @@ TEST_F(DeclarableOpsTests1, Test_Range_Integer_1) { sd::ops::range op; auto result = op.evaluate({}, {}, { 1, 5, 1 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto array = result->at(0); + auto array = result.at(0); // array->printIndexedBuffer("Range integer 1"); ASSERT_TRUE(exp.isSameShape(array)); ASSERT_TRUE(exp.equalsTo(array)); - delete result; + } @@ -2887,16 +2884,16 @@ TEST_F(DeclarableOpsTests1, Test_Range_Integer_2) { sd::ops::range op; auto result = op.evaluate({ &start, &stop, &step }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto array = result->at(0); + auto array = result.at(0); ASSERT_TRUE(exp.isSameShape(array)); ASSERT_TRUE(exp.equalsTo(array)); - delete result; + } @@ -2907,16 +2904,16 @@ TEST_F(DeclarableOpsTests1, Test_Range_Integer_3) { sd::ops::range op; auto result = op.evaluate({}, { 1.f, 5.f, 1.f }, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto array = result->at(0); + auto array = result.at(0); ASSERT_TRUE(exp.isSameShape(array)); ASSERT_TRUE(exp.equalsTo(array)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -2928,13 +2925,13 @@ TEST_F(DeclarableOpsTests1, softmax_test1) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, {}, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2944,13 +2941,13 @@ TEST_F(DeclarableOpsTests1, softmax_test2) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 1 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2960,13 +2957,13 @@ TEST_F(DeclarableOpsTests1, softmax_test3) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 0 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2976,13 +2973,13 @@ TEST_F(DeclarableOpsTests1, softmax_test4) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 1 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2992,13 +2989,13 @@ TEST_F(DeclarableOpsTests1, softmax_test5) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 0 }); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3008,13 +3005,13 @@ TEST_F(DeclarableOpsTests1, softmax_test6) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 0 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3024,13 +3021,13 @@ TEST_F(DeclarableOpsTests1, softmax_test7) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 1 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3040,13 +3037,13 @@ TEST_F(DeclarableOpsTests1, softmax_test8) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, {}, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3056,13 +3053,13 @@ TEST_F(DeclarableOpsTests1, softmax_test9) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 2 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests1, softmax_test10) { @@ -3071,13 +3068,13 @@ TEST_F(DeclarableOpsTests1, softmax_test10) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 4 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests1, softmax_test11) { @@ -3086,13 +3083,13 @@ TEST_F(DeclarableOpsTests1, softmax_test11) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 4 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3105,13 +3102,13 @@ TEST_F(DeclarableOpsTests1, softmax_test12) { sd::ops::softmax op; auto results = op.evaluate({ &input }, {}, { 3 }, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests1, Reverse_1) { @@ -3128,14 +3125,14 @@ TEST_F(DeclarableOpsTests1, Reverse_1) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 0,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3153,14 +3150,14 @@ TEST_F(DeclarableOpsTests1, Reverse_2) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, {}, {}, {}, true); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(input)); ASSERT_TRUE(expected.equalsTo(&input)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3178,15 +3175,15 @@ TEST_F(DeclarableOpsTests1, Reverse_3) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3204,15 +3201,15 @@ TEST_F(DeclarableOpsTests1, Reverse_4) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 0,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3230,14 +3227,14 @@ TEST_F(DeclarableOpsTests1, Reverse_5) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 0,1 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -3255,15 +3252,15 @@ TEST_F(DeclarableOpsTests1, Reverse_6) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 2 }, {}, {}, true); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(input)); ASSERT_TRUE(expected.equalsTo(&input)); - delete results; + } @@ -3282,16 +3279,16 @@ TEST_F(DeclarableOpsTests1, Reverse_7) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 1 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); //expected.printIndexedBuffer("E"); //result->printIndexedBuffer("R"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -3311,15 +3308,15 @@ TEST_F(DeclarableOpsTests1, Reverse_8) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 2,1 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -3337,14 +3334,14 @@ TEST_F(DeclarableOpsTests1, Reverse_9) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 0 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } TEST_F(DeclarableOpsTests1, Reverse_10) { @@ -3355,12 +3352,12 @@ TEST_F(DeclarableOpsTests1, Reverse_10) { sd::ops::reverse op; auto result = op.evaluate({ &x, &i }, {}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -3376,14 +3373,14 @@ TEST_F(DeclarableOpsTests1, Reverse_11) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 0, 1, 2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3397,15 +3394,15 @@ TEST_F(DeclarableOpsTests1, Reverse_12) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { 0 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); //result->printIndexedBuffer("Result reverse"); //expected.printIndexedBuffer("Expected reverse"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3419,14 +3416,14 @@ TEST_F(DeclarableOpsTests1, Reverse_13) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, { -1 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -3440,14 +3437,14 @@ TEST_F(DeclarableOpsTests1, Reverse_14) { sd::ops::reverse op; auto results = op.evaluate({ &input }, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } TEST_F(DeclarableOpsTests1, Test_Expose_1) { @@ -3458,15 +3455,15 @@ TEST_F(DeclarableOpsTests1, Test_Expose_1) { auto result = op.evaluate({ &input0, &input1 }); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z0 = result->at(0); - auto z1 = result->at(1); + auto z0 = result.at(0); + auto z1 = result.at(1); ASSERT_TRUE(input0.equalsTo(z0)); ASSERT_TRUE(input1.equalsTo(z1)); - delete result; + } TEST_F(DeclarableOpsTests1, Test_Expose_2) { diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests10.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests10.cpp index 0ea90f2ce..efd46d1b5 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests10.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests10.cpp @@ -61,14 +61,12 @@ TEST_F(DeclarableOpsTests10, Test_ArgMax_1) { sd::ops::argmax op; auto result = op.evaluate({&x}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = *result->at(0); + auto z = *result.at(0); ASSERT_EQ(e, z); - - delete result; } TEST_F(DeclarableOpsTests10, Test_ArgMax_2) { @@ -80,16 +78,14 @@ TEST_F(DeclarableOpsTests10, Test_ArgMax_2) { sd::ops::argmax op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = *result->at(0); + auto z = *result.at(0); //z.printIndexedBuffer("z"); //z.printShapeInfo("z shape"); ASSERT_EQ(e, z); - - delete result; } TEST_F(DeclarableOpsTests10, Test_And_1) { @@ -99,11 +95,9 @@ TEST_F(DeclarableOpsTests10, Test_And_1) { sd::ops::boolean_and op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(e, *result->at(0)); - - delete result; + ASSERT_EQ(e, *result.at(0)); } TEST_F(DeclarableOpsTests10, Test_Or_1) { @@ -113,11 +107,9 @@ TEST_F(DeclarableOpsTests10, Test_Or_1) { sd::ops::boolean_or op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(e, *result->at(0)); - - delete result; + ASSERT_EQ(e, *result.at(0)); } TEST_F(DeclarableOpsTests10, Test_Not_1) { @@ -128,12 +120,10 @@ TEST_F(DeclarableOpsTests10, Test_Not_1) { sd::ops::boolean_not op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); - auto res = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto res = result.at(0); ASSERT_TRUE(e.equalsTo(res)); - - delete result; } TEST_F(DeclarableOpsTests10, Test_Size_at_1) { @@ -142,11 +132,10 @@ TEST_F(DeclarableOpsTests10, Test_Size_at_1) { sd::ops::size_at op; auto result = op.evaluate({&x}, {1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(e, *result->at(0)); - - delete result; + ASSERT_EQ(e, *result.at(0)); + } //////////////////////////////////////////////////////////////////////////////// @@ -162,10 +151,9 @@ TEST_F(DeclarableOpsTests10, MirrorPad_SGO_Test_1) { sd::ops::mirror_pad op; auto res = op.evaluate({&in, &pad}, {10.0}, {0}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - delete res; + ASSERT_TRUE(exp.equalsTo(res.at(0))); } //////////////////////////////////////////////////////////////////////////////// @@ -176,13 +164,13 @@ TEST_F(DeclarableOpsTests10, Unique_SGO_Test_1) { sd::ops::unique op; auto res = op.evaluate({&input}, {}, {}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto res1 = res->at(0); - auto res2 = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto res1 = res.at(0); + auto res2 = res.at(1); ASSERT_TRUE(exp.equalsTo(res1)); ASSERT_TRUE(expIdx.equalsTo(res2)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -193,13 +181,13 @@ TEST_F(DeclarableOpsTests10, Where_SGO_Test_1) { sd::ops::Where op; auto res = op.evaluate({&input}, {}, {}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); ASSERT_TRUE(exp.isSameShape(resA)); ASSERT_TRUE(exp.equalsTo(resA)); -// ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; +// ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -210,13 +198,13 @@ TEST_F(DeclarableOpsTests10, Where_SGO_Test_02) { sd::ops::Where op; auto res = op.evaluate({&input}, {}, {}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); ASSERT_TRUE(exp.equalsTo(resA)); ASSERT_TRUE(exp.isSameShape(resA)); -// ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; +// ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -228,19 +216,19 @@ TEST_F(DeclarableOpsTests10, WhereNP_SGO_Test_1) { auto exp3 = NDArrayFactory::create({0, 1, 0, 1, 0}); sd::ops::where_np op; auto res = op.evaluate({&cond3d}, {}, {}); - ASSERT_TRUE(res->size() == 3); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto res1 = res->at(0); - auto res2 = res->at(1); - auto res3 = res->at(2); + ASSERT_TRUE(res.size() == 3); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto res1 = res.at(0); + auto res2 = res.at(1); + auto res3 = res.at(2); // res1->printShapeInfo("Res1 shape"); res1->printBuffer("Res1"); // res2->printShapeInfo("Res2 shape"); res2->printBuffer("Res2"); // res3->printShapeInfo("Res3 shape"); res3->printBuffer("Res3"); ASSERT_TRUE(exp1.equalsTo(res1)); ASSERT_TRUE(exp2.equalsTo(res2)); ASSERT_TRUE(exp3.equalsTo(res3)); - //ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; + //ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -252,12 +240,12 @@ TEST_F(DeclarableOpsTests10, WhereNP_SGO_Test_2) { auto exp2 = NDArrayFactory::create({0, 1, 4, 0, 1, 2, 3, 4, 1, 2, 3, 4}); sd::ops::where_np op; auto res = op.evaluate({&cond2d}, {}, {}); - ASSERT_TRUE(res->size() == 2); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - ASSERT_TRUE(exp1.equalsTo(res->at(0))); - ASSERT_TRUE(exp2.equalsTo(res->at(1))); - //ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; + ASSERT_TRUE(res.size() == 2); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + ASSERT_TRUE(exp1.equalsTo(res.at(0))); + ASSERT_TRUE(exp2.equalsTo(res.at(1))); + //ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -268,14 +256,14 @@ TEST_F(DeclarableOpsTests10, Where_SGO_Test_2) { sd::ops::Where op; auto res = op.evaluate({&input}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); // resA->printIndexedBuffer("Result A"); // resA->printShapeInfo("ShapeA"); ASSERT_TRUE(exp.equalsTo(resA)); ASSERT_TRUE(exp.isSameShape(resA)); -// ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; +// ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -286,14 +274,14 @@ TEST_F(DeclarableOpsTests10, Where_SGO_Test_3) { sd::ops::Where op; auto res = op.evaluate({&input}, {}, {}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); //resA->printIndexedBuffer("Result A"); //resA->printShapeInfo("ShapeA"); ASSERT_TRUE(exp.equalsTo(resA)); ASSERT_TRUE(exp.isSameShape(resA)); -// ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; +// ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -304,15 +292,15 @@ TEST_F(DeclarableOpsTests10, Where_SGO_Test_4) { sd::ops::Where op; auto res = op.evaluate({&input}, {}, {}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); ASSERT_TRUE(resA->isEmpty()); //resA->printIndexedBuffer("Result A"); //resA->printShapeInfo("ShapeA"); //ASSERT_TRUE(exp.equalsTo(resA)); //ASSERT_TRUE(exp.isSameShape(resA)); -// ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; +// ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -323,14 +311,14 @@ TEST_F(DeclarableOpsTests10, Where_SGO_Test_5) { sd::ops::Where op; auto res = op.evaluate({&input}, {}, {}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); //ASSERT_TRUE(resA->isEmpty()); ASSERT_TRUE(exp.equalsTo(resA)); ASSERT_TRUE(exp.isSameShape(resA)); -// ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; +// ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -341,15 +329,15 @@ TEST_F(DeclarableOpsTests10, WhereNP_SGO_Test_4) { sd::ops::where_np op; auto res = op.evaluate({&input}, {}, {}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); ASSERT_TRUE(resA->isEmpty()); //resA->printIndexedBuffer("Result A"); //resA->printShapeInfo("ShapeA"); //ASSERT_TRUE(exp.equalsTo(resA)); //ASSERT_TRUE(exp.isSameShape(resA)); -// ASSERT_TRUE(expIdx.equalsTo(res->at(1))); - delete res; +// ASSERT_TRUE(expIdx.equalsTo(res.at(1))); + } //////////////////////////////////////////////////////////////////////////////// @@ -362,12 +350,11 @@ TEST_F(DeclarableOpsTests10, CosineDistance_SGO_Test_1) { sd::ops::cosine_distance_loss op; auto res = op.evaluate({&predictions, &weights, &labels}, {}, {3, 1}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); ASSERT_TRUE(exp.equalsTo(resA)); - - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -380,12 +367,11 @@ TEST_F(DeclarableOpsTests10, CosineDistance_SGO_Test_2) { sd::ops::cosine_distance_loss op; auto res = op.evaluate({&predictions, &weights, &labels}, {}, {2, 1}); - ASSERT_TRUE(res->status() == ND4J_STATUS_OK); - auto resA = res->at(0); + ASSERT_TRUE(res.status() == ND4J_STATUS_OK); + auto resA = res.at(0); ASSERT_TRUE(exp.equalsTo(resA)); - - delete res; + } /////////////////////////////////////////////////////////////////// @@ -404,12 +390,10 @@ TEST_F(DeclarableOpsTests10, TestMarixBandPart_Test_1) { sd::ops::matrix_band_part op; auto results = op.evaluate({&x}, {}, {1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); - //results->at(0)->printIndexedBuffer("MBP Test1"); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); + //results.at(0)->printIndexedBuffer("MBP Test1"); //exp.printIndexedBuffer("MBP Expec"); - ASSERT_TRUE(exp.equalsTo(results->at(0))); - - delete results; + ASSERT_TRUE(exp.equalsTo(results.at(0))); } ////////////////////////////////////////////////////////////////////////////// @@ -423,13 +407,11 @@ TEST_F(DeclarableOpsTests10, atan2_test1) { sd::ops::tf_atan2 op; auto result = op.evaluate({&y, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -443,16 +425,14 @@ TEST_F(DeclarableOpsTests10, atan2_test2) { sd::ops::tf_atan2 op; auto result = op.evaluate({&y, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); // z->printIndexedBuffer(); // x.applyTrueBroadcast(sd::BroadcastOpsTuple::custom(scalar::Atan2, pairwise::Atan2, broadcast::Atan2), &y, &z, true); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -466,13 +446,11 @@ TEST_F(DeclarableOpsTests10, atan2_test3) { sd::ops::tf_atan2 op; auto result = op.evaluate({&x, &y}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -486,13 +464,11 @@ TEST_F(DeclarableOpsTests10, atan2_test4) { sd::ops::tf_atan2 op; auto result = op.evaluate({&x, &y}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -506,13 +482,11 @@ TEST_F(DeclarableOpsTests10, atan2_test5) { sd::ops::tf_atan2 op; auto result = op.evaluate({&y, &x}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -525,13 +499,11 @@ TEST_F(DeclarableOpsTests10, atan2_test6) { sd::ops::tf_atan2 op; auto result = op.evaluate({&y, &x}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -547,14 +519,12 @@ TEST_F(DeclarableOpsTests10, IGamma_Test1) { sd::ops::igamma op; auto result = op.evaluate({&y, &x}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); // z->printBuffer("OUtput"); // exp.printBuffer("EXpect"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -569,14 +539,12 @@ TEST_F(DeclarableOpsTests10, IGamma_Test2) { sd::ops::igammac op; auto result = op.evaluate({&y, &x}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); // z->printBuffer("OUtput"); // exp.printBuffer("EXpect"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -592,14 +560,14 @@ TEST_F(DeclarableOpsTests10, LGamma_Test1) { sd::ops::lgamma op; auto result = op.evaluate({&x}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); // z->printBuffer("OUtput"); // exp.printBuffer("EXpect"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////////////// @@ -612,14 +580,12 @@ TEST_F(DeclarableOpsTests10, range_test10) { sd::ops::range op; auto result = op.evaluate({&limit}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -634,14 +600,12 @@ TEST_F(DeclarableOpsTests10, range_test11) { sd::ops::range op; auto result = op.evaluate({&start, &limit}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -652,14 +616,12 @@ TEST_F(DeclarableOpsTests10, range_test12) { sd::ops::range op; auto result = op.evaluate({}, {0.5, 5, 0.5}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } ////////////////////////////////////////////////////////////////////////////// @@ -673,26 +635,23 @@ TEST_F(DeclarableOpsTests10, top_k_permuted_test1) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {4}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); - auto zI = result->at(1); + auto z = result.at(0); + auto zI = result.at(1); ASSERT_TRUE(expUnsorted.isSameShape(z)); ASSERT_TRUE(expUnsorted.equalsTo(z)); auto result2 = op.evaluate({&x}, {}, {5}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result2->status()); + ASSERT_EQ(ND4J_STATUS_OK, result2.status()); - z = result2->at(0); - zI = result2->at(1); + z = result2.at(0); + zI = result2.at(1); ASSERT_TRUE(expSorted.isSameShape(z)); ASSERT_TRUE(expSorted.equalsTo(z)); - - delete result; - delete result2; } ////////////////////////////////////////////////////////////////////////////// @@ -706,26 +665,23 @@ TEST_F(DeclarableOpsTests10, top_k_permuted_test2) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {5}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); - auto zI = result->at(1); + auto z = result.at(0); + auto zI = result.at(1); ASSERT_TRUE(expUnsorted.isSameShape(z)); ASSERT_TRUE(expUnsorted.equalsTo(z)); auto result2 = op.evaluate({&x}, {}, {5}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result2->status()); + ASSERT_EQ(ND4J_STATUS_OK, result2.status()); - z = result2->at(0); - zI = result2->at(1); + z = result2.at(0); + zI = result2.at(1); ASSERT_TRUE(expSorted.isSameShape(z)); ASSERT_TRUE(expSorted.equalsTo(z)); - - delete result; - delete result2; } /////////////////////////////////////////////////////////////////// @@ -740,14 +696,12 @@ TEST_F(DeclarableOpsTests10, sparse_softmax_cross_entropy_loss_with_logits_test1 sd::ops::sparse_softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&labels, &logits}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -762,14 +716,12 @@ TEST_F(DeclarableOpsTests10, sparse_softmax_cross_entropy_loss_with_logits_test2 sd::ops::sparse_softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&labels, &logits}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -784,14 +736,12 @@ TEST_F(DeclarableOpsTests10, sparse_softmax_cross_entropy_loss_with_logits_test3 sd::ops::sparse_softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&labels, &logits}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -806,14 +756,12 @@ TEST_F(DeclarableOpsTests10, sparse_softmax_cross_entropy_loss_with_logits_test4 sd::ops::sparse_softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&labels, &logits}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -827,17 +775,15 @@ TEST_F(DeclarableOpsTests10, split_test4) { sd::ops::split op; auto results = op.evaluate({&input, &axis}, {}, {2}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto out1 = results->at(0); - auto out2 = results->at(1); + auto out1 = results.at(0); + auto out2 = results.at(1); ASSERT_TRUE(exp1.isSameShape(out1)); ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp1.equalsTo(out1)); ASSERT_TRUE(exp2.equalsTo(out2)); - - delete results; } @@ -851,17 +797,15 @@ TEST_F(DeclarableOpsTests10, split_test5) { sd::ops::split op; auto results = op.evaluate({&input}, {}, {2,-1},{}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto out1 = results->at(0); - auto out2 = results->at(1); + auto out1 = results.at(0); + auto out2 = results.at(1); ASSERT_TRUE(exp1.isSameShape(out1)); ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp1.equalsTo(out1)); ASSERT_TRUE(exp2.equalsTo(out2)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -874,14 +818,12 @@ TEST_F(DeclarableOpsTests10, histogram_fixed_width_test1) { sd::ops::histogram_fixed_width op; auto results = op.evaluate({&input, &range}, {}, {5}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto out = results->at(0); + auto out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -894,14 +836,12 @@ TEST_F(DeclarableOpsTests10, histogram_fixed_width_test2) { sd::ops::histogram_fixed_width op; auto results = op.evaluate({&input, &range}, {}, {5}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto out = results->at(0); + auto out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -914,14 +854,12 @@ TEST_F(DeclarableOpsTests10, histogram_fixed_width_test3) { sd::ops::histogram_fixed_width op; auto results = op.evaluate({&input, &range}, {}, {5}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto out = results->at(0); + auto out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -939,14 +877,12 @@ TEST_F(DeclarableOpsTests10, histogram_fixed_width_test4) { sd::ops::histogram_fixed_width op; auto results = op.evaluate({&input, &range}, {}, {5}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto out = results->at(0); + auto out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -965,15 +901,13 @@ TEST_F(DeclarableOpsTests10, histogram_fixed_width_test5) { sd::ops::histogram_fixed_width op; auto results = op.evaluate({&input, &range}, {}, {5}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *out = results->at(0); + auto *out = results.at(0); ASSERT_TRUE(exp.isSameShape(out)); // out->printBuffer("5HIST"); ASSERT_TRUE(exp.equalsTo(out)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -988,16 +922,14 @@ TEST_F(DeclarableOpsTests10, histogram_fixed_width_test6) { sd::ops::histogram_fixed_width op; auto results = op.evaluate({&input, &range, &bins}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto out = results->at(0); + auto out = results.at(0); // out->printShapeInfo(); // out->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(out)); ASSERT_TRUE(exp.equalsTo(out)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1012,14 +944,12 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_1) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1034,14 +964,12 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_2) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1056,14 +984,12 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_3) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {1}); // with reverse = true - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1078,14 +1004,12 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_4) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, NTH_Element_Test_04) { @@ -1099,14 +1023,12 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_04) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, NTH_Element_Test_5) { @@ -1120,14 +1042,12 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_5) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1142,13 +1062,11 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_6) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, NTH_Element_Test_06) { @@ -1162,13 +1080,11 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_06) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, NTH_Element_Test_7) { @@ -1188,14 +1104,12 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_7) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, NTH_Element_Test_8) { @@ -1215,14 +1129,12 @@ TEST_F(DeclarableOpsTests10, NTH_Element_Test_8) { sd::ops::nth_element op; auto results = op.evaluate({&input, &n}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* output = results->at(0); + NDArray* output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1237,14 +1149,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test1) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1259,14 +1169,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test2) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1281,14 +1189,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test3) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1301,14 +1207,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test4) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1321,14 +1225,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test5) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1341,14 +1243,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test6) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1361,14 +1261,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test7) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1383,14 +1281,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test8) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1405,14 +1301,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test9) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1427,14 +1321,12 @@ TEST_F(DeclarableOpsTests10, broadcast_to_test10) { sd::ops::broadcast_to op; auto results = op.evaluate({&input, &shape}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -1483,15 +1375,15 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test1) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input}, {}, {10, 10}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); - //result->printIndexedBuffer("Resized to 10x10"); + //result.printIndexedBuffer("Resized to 10x10"); //expected.printIndexedBuffer("Expect for 10x10"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1505,12 +1397,10 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test_11) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input, &size}, {}, {}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); ASSERT_NE(*result, ex); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -1524,12 +1414,10 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test_12) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input, &size}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); ASSERT_NE(*result, ex); - - delete results; } TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test1_1) { @@ -1568,15 +1456,15 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test1_1) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input}, {}, {4, 5}, {false, true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printIndexedBuffer("Resized to 4x5 bilinear with half pixels"); +// result.printIndexedBuffer("Resized to 4x5 bilinear with half pixels"); //expected.printIndexedBuffer("Expect for 10x10"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test1_2) { @@ -1615,15 +1503,15 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test1_2) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input}, {}, {4, 5}, {false, true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 4x5"); +// result.printBuffer("Resized to 4x5"); // expected.printBuffer("Expect for 4x5"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test01) { @@ -1671,17 +1559,17 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test01) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input}, {}, {10, 10}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); - //result->printIndexedBuffer("Resized to 10x10"); + //result.printIndexedBuffer("Resized to 10x10"); //expected.printIndexedBuffer("Expect for 10x10"); -// result->printShapeInfo("Output shape"); +// result.printShapeInfo("Output shape"); // expected.printShapeInfo("Expect shape"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test02) { @@ -1826,17 +1714,17 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test02) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input}, {}, {9, 9}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 9x9"); +// result.printBuffer("Resized to 9x9"); // expected.printBuffer("Expect for 9x9"); -// result->printShapeInfo("Output shape"); +// result.printShapeInfo("Output shape"); // expected.printShapeInfo("Expect shape"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1885,14 +1773,12 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test2) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2015,14 +1901,12 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test3) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input}, {}, {10, 10}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2144,16 +2028,14 @@ TEST_F(DeclarableOpsTests10, ImageResizeBilinear_Test4) { sd::ops::resize_bilinear op; auto results = op.evaluate({&input, &size}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); -// result->printIndexedBuffer("Resized to 10x10"); + NDArray* result = results.at(0); +// result.printIndexedBuffer("Resized to 10x10"); // expected.printIndexedBuffer("Expected of 10x10"); -// result->printShapeInfo("Resized to 10x10 shape"); +// result.printShapeInfo("Resized to 10x10 shape"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2167,11 +2049,11 @@ TEST_F(DeclarableOpsTests10, LinSpace_Test1) { sd::ops::lin_space op; auto result = op.evaluate({&start, &finish, &num}, {}, {}); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - auto res = result->at(0); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + auto res = result.at(0); ASSERT_TRUE(expect.equalsTo(res)); - delete result; + } //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, ImageResizeNeighbor_Test1) { @@ -2210,16 +2092,14 @@ TEST_F(DeclarableOpsTests10, ImageResizeNeighbor_Test1) { sd::ops::resize_nearest_neighbor op; auto results = op.evaluate({&input}, {}, {4, 5}, {false, false}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printIndexedBuffer("Resized to 4x5"); +// result.printIndexedBuffer("Resized to 4x5"); // expected.printIndexedBuffer("Expect for 4x5"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, ImageResizeNeighbor_Test1_1) { @@ -2258,16 +2138,14 @@ TEST_F(DeclarableOpsTests10, ImageResizeNeighbor_Test1_1) { sd::ops::resize_nearest_neighbor op; auto results = op.evaluate({&input}, {}, {4, 5}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printIndexedBuffer("Resized to 4x5"); +// result.printIndexedBuffer("Resized to 4x5"); // expected.printIndexedBuffer("Expect for 4x5"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, ImageResizeNeighbor_Test1_1_1) { @@ -2306,16 +2184,14 @@ TEST_F(DeclarableOpsTests10, ImageResizeNeighbor_Test1_1_1) { sd::ops::resize_nearest_neighbor op; auto results = op.evaluate({&input}, {}, {4,5}, {false, true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printIndexedBuffer("Resized to 4x5"); +// result.printIndexedBuffer("Resized to 4x5"); // expected.printBuffer("Expect for 4x5"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, ImageResizeNeighbor_Test01) { @@ -2353,16 +2229,14 @@ TEST_F(DeclarableOpsTests10, ImageResizeNeighbor_Test01) { sd::ops::resize_nearest_neighbor op; auto results = op.evaluate({&input}, {}, {4, 5}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); - //result->printIndexedBuffer("Resized to 4x5"); + //result.printIndexedBuffer("Resized to 4x5"); //expected.printIndexedBuffer("Expect for 4x5"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2375,15 +2249,13 @@ TEST_F(DeclarableOpsTests10, ReduceLogSumExpTest_1) { sd::ops::reduce_logsumexp op; auto results = op.evaluate({&input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; - } //////////////////////////////////////////////////////////////////// @@ -2396,15 +2268,15 @@ TEST_F(DeclarableOpsTests10, ReduceLogSumExpTest_2) { sd::ops::reduce_logsumexp op; auto results = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printIndexedBuffer("REDUCE_LOGSUMEXP"); + auto result = results.at(0); +// result.printIndexedBuffer("REDUCE_LOGSUMEXP"); // expected.printIndexedBuffer("LSE EXPECTED"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, ReduceLogSumExpTest_3) { @@ -2416,15 +2288,13 @@ TEST_F(DeclarableOpsTests10, ReduceLogSumExpTest_3) { sd::ops::reduce_logsumexp op; auto results = op.evaluate({&input}, {1.f}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printIndexedBuffer("REDUCE_LOGSUMEXP"); + auto result = results.at(0); +// result.printIndexedBuffer("REDUCE_LOGSUMEXP"); // expected.printIndexedBuffer("LSE EXPECTED"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_1) { @@ -2437,15 +2307,15 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_1) { sd::ops::non_max_suppression op; auto results = op.evaluate({&boxes, &scores}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); - //result->printIndexedBuffer("OOOOUUUUTTT"); + NDArray* result = results.at(0); + //result.printIndexedBuffer("OOOOUUUUTTT"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -2459,14 +2329,12 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_2) { sd::ops::non_max_suppression op; auto results = op.evaluate({&boxes, &scales}, {0.5}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppression OUtput2"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppression OUtput2"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2481,14 +2349,12 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_3) { sd::ops::non_max_suppression op; auto results = op.evaluate({&boxes, &scales}, {0.5, 0.5}, {2}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppression OUtput3"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppression OUtput3"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_4) { @@ -2504,14 +2370,12 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_4) { sd::ops::non_max_suppression op; auto results = op.evaluate({&boxes, &scales, &maxSize, &threshold, &scoreThreshold}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppression OUtput4"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppression OUtput4"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_5) { @@ -2526,14 +2390,12 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_5) { sd::ops::non_max_suppression op; auto results = op.evaluate({&boxes, &scales, &maxSize, &threshold, &scoreThreshold}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppression OUtput4"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppression OUtput4"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_6) { @@ -2549,15 +2411,13 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_6) { sd::ops::non_max_suppression_v3 op; auto results = op.evaluate({&boxes, &scales, &maxSize, &threshold, &scoreThreshold}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppression OUtput6"); -// result->printShapeInfo("Ouput6 shape is"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppression OUtput6"); +// result.printShapeInfo("Ouput6 shape is"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_06) { @@ -2573,15 +2433,13 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_06) { sd::ops::non_max_suppression_v3 op; auto results = op.evaluate({&boxes, &scales, &maxSize, &threshold, &scoreThreshold}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppression OUtput06"); -// result->printShapeInfo("Ouput06 shape is"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppression OUtput06"); +// result.printShapeInfo("Ouput06 shape is"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_7) { @@ -2596,14 +2454,12 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressing_7) { sd::ops::non_max_suppression_v3 op; auto results = op.evaluate({&boxes, &scales, &maxSize, &threshold, &scoreThreshold}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppression OUtput7"); -// result->printShapeInfo("Ouput6 shape is"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppression OUtput7"); +// result.printShapeInfo("Ouput6 shape is"); ASSERT_TRUE(result->isEmpty()); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2621,14 +2477,12 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressingOverlap_1) { sd::ops::non_max_suppression_overlaps op; auto results = op.evaluate({&boxes, &scores, &max_num}, {0.5, 0.}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppressionOverlap1 Output"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppressionOverlap1 Output"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2646,14 +2500,12 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressingOverlap_2) { sd::ops::non_max_suppression_overlaps op; auto results = op.evaluate({&boxes, &scores, &max_num}, {0.5, 0.}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppressionOverlap Output"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppressionOverlap Output"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2671,14 +2523,12 @@ TEST_F(DeclarableOpsTests10, Image_NonMaxSuppressingOverlap_3) { sd::ops::non_max_suppression_overlaps op; auto results = op.evaluate({&boxes, &scores, &max_num}, {0.5, 0.}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); -// result->printBuffer("NonMaxSuppressionOverlap Output"); + NDArray* result = results.at(0); +// result.printBuffer("NonMaxSuppressionOverlap Output"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2695,15 +2545,13 @@ TEST_F(DeclarableOpsTests10, Image_CropAndResize_1) { sd::ops::crop_and_resize op; auto results = op.evaluate({&images, &boxes, &boxI, &cropSize}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printIndexedBuffer("Cropped and Resized"); + auto result = results.at(0); +// result.printIndexedBuffer("Cropped and Resized"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2720,14 +2568,12 @@ TEST_F(DeclarableOpsTests10, Image_CropAndResize_2) { sd::ops::crop_and_resize op; auto results = op.evaluate({&images, &boxes, &boxI, &cropSize}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2744,14 +2590,12 @@ TEST_F(DeclarableOpsTests10, Image_CropAndResize_3) { sd::ops::crop_and_resize op; auto results = op.evaluate({&images, &boxes, &boxI, &cropSize}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2768,14 +2612,12 @@ TEST_F(DeclarableOpsTests10, Image_CropAndResize_4) { sd::ops::crop_and_resize op; auto results = op.evaluate({&images, &boxes, &boxI, &cropSize}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); - // result->printIndexedBuffer("Cropped and Resized"); + auto result = results.at(0); + // result.printIndexedBuffer("Cropped and Resized"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2792,14 +2634,12 @@ TEST_F(DeclarableOpsTests10, Image_CropAndResize_5) { sd::ops::crop_and_resize op; auto results = op.evaluate({&images, &boxes, &boxI, &cropSize}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); //ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2828,16 +2668,14 @@ TEST_F(DeclarableOpsTests10, Image_DrawBoundingBoxes_1) { sd::ops::draw_bounding_boxes op; auto results = op.evaluate({&images, &boxes, &colors}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); result->syncToHost(); -// result->printBuffer("Bounded boxes"); +// result.printBuffer("Bounded boxes"); // expected.printBuffer("Bounded expec"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2861,16 +2699,14 @@ TEST_F(DeclarableOpsTests10, Image_DrawBoundingBoxes_2) { sd::ops::draw_bounding_boxes op; auto results = op.evaluate({&images, &boxes, &colors}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->syncToHost(); -// result->printBuffer("Bounded boxes 2"); + auto result = results.at(0); +// result.syncToHost(); +// result.printBuffer("Bounded boxes 2"); // expected.printBuffer("Bounded expec 2"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2913,19 +2749,17 @@ TEST_F(DeclarableOpsTests10, Image_DrawBoundingBoxes_3) { 0.5793f, 0.573f , 0.1822f, 0.642f , 0.9143f}); sd::ops::draw_bounding_boxes op; auto results = op.evaluate({&images, &boxes, &colors}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printBuffer("Boxes3 output"); + auto result = results.at(0); +// result.printBuffer("Boxes3 output"); // expected.printBuffer("Boxes3 expect"); -// result->syncToHost(); -// result->printBuffer("Bounded boxes 2"); +// result.syncToHost(); +// result.printBuffer("Bounded boxes 2"); // expected.printBuffer("Bounded expec 2"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2939,15 +2773,13 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_1) { sd::ops::fake_quant_with_min_max_vars op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printBuffer("Quantized"); + auto result = results.at(0); +// result.printBuffer("Quantized"); // exp.printBuffer("Expected"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_2) { @@ -2960,14 +2792,12 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_2) { sd::ops::fake_quant_with_min_max_vars op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); - // result->printIndexedBuffer("Quantized2"); + auto result = results.at(0); + // result.printIndexedBuffer("Quantized2"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2981,14 +2811,12 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_3) { sd::ops::fake_quant_with_min_max_vars_per_channel op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); - // result->printIndexedBuffer("Quantized2"); + auto result = results.at(0); + // result.printIndexedBuffer("Quantized2"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_03) { @@ -3005,15 +2833,14 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_03) { sd::ops::fake_quant_with_min_max_vars_per_channel op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printIndexedBuffer("Quantized03"); + auto result = results.at(0); +// result.printIndexedBuffer("Quantized03"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } + TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_03_1) { NDArray x = NDArrayFactory::create('c', {3,5}, {0.7788f,0.8012f, 0.7244f, 0.2309f,0.7271f, 0.1804f, 0.5056f, 0.8925f, 0.5461f, 0.9234f, @@ -3028,14 +2855,12 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_03_1) { sd::ops::fake_quant_with_min_max_vars_per_channel op; auto results = op.evaluate({&x, &min, &max}, {}, {8}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printIndexedBuffer("Quantized03_1"); + auto result = results.at(0); +// result.printIndexedBuffer("Quantized03_1"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_03_2) { @@ -3052,14 +2877,12 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_03_2) { sd::ops::fake_quant_with_min_max_vars_per_channel op; auto results = op.evaluate({&x, &min, &max}, {}, {6}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); result->printIndexedBuffer("Quantized03_2"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_03_3) { @@ -3075,14 +2898,12 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_03_3) { sd::ops::fake_quant_with_min_max_vars_per_channel op; auto results = op.evaluate({&x, &min, &max}, {}, {6}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); result->printIndexedBuffer("Quantized03_3"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -3114,17 +2935,15 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_4) { sd::ops::fake_quant_with_min_max_vars_per_channel op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printBuffer("Quantized per channels 4"); + auto result = results.at(0); +// result.printBuffer("Quantized per channels 4"); // exp.printBuffer("Quantized per channest E"); // auto diff = *result - exp; // diff.printIndexedBuffer("Difference"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_5) { @@ -3167,18 +2986,16 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_5) { sd::ops::fake_quant_with_min_max_vars_per_channel op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printBuffer("Quantized per channels 5"); + auto result = results.at(0); +// result.printBuffer("Quantized per channels 5"); // exp.printBuffer("Quantized per channest E"); // auto diff = *result - exp; // diff.printIndexedBuffer("Difference"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_6) { @@ -3201,18 +3018,16 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_6) { sd::ops::fake_quant_with_min_max_vars_per_channel op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printBuffer("Quantized per channels 5"); + auto result = results.at(0); +// result.printBuffer("Quantized per channels 5"); // exp.printBuffer("Quantized per channest E"); // auto diff = *result - exp; // diff.printIndexedBuffer("Difference"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } ////////////////////////////////////////////////////////////////// @@ -3247,15 +3062,13 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_7) { sd::ops::fake_quant_with_min_max_vars op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printBuffer("Quantized7"); + auto result = results.at(0); +// result.printBuffer("Quantized7"); // exp.printBuffer("Expected 7"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } ////////////////////////////////////////////////////////////////// @@ -3272,16 +3085,14 @@ TEST_F(DeclarableOpsTests10, FakeQuantWithMinMaxVars_Test_8) { sd::ops::fake_quant_with_min_max_vars op; auto results = op.evaluate({&x, &min, &max}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // x.printBuffer("SourInput8"); -// result->printBuffer("Quantized8"); +// result.printBuffer("Quantized8"); // exp.printBuffer("Expected 8"); ASSERT_TRUE(exp.isSameShapeStrict(*result)); ASSERT_TRUE(exp.equalsTo(result)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -3350,4 +3161,3 @@ TEST_F(DeclarableOpsTests10, printIndexedTest_1) { printf("]\n"); } - diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests11.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests11.cpp index 177893ba4..b8c89322c 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests11.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests11.cpp @@ -45,9 +45,9 @@ TEST_F(DeclarableOpsTests11, test_listdiff_1) { sd::ops::listdiff op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; + } /////////////////////////////////////////////////////////////////// @@ -71,11 +71,11 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test1) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {0}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -83,8 +83,6 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test1) { ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -103,14 +101,12 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test2) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -133,11 +129,11 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test3) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -145,8 +141,6 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test3) { ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -165,16 +159,14 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test4) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); // dLdw->printIndexedBuffer(); // dLdw->printShapeInfo(); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -198,11 +190,11 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test5) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -210,8 +202,6 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test5) { ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -230,14 +220,12 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test6) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -256,14 +244,12 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test7) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -291,11 +277,11 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test8) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -303,8 +289,6 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test8) { ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -328,11 +312,11 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test9) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -340,8 +324,6 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test9) { ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -360,14 +342,12 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test10) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -386,14 +366,12 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test11) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -423,11 +401,11 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test12) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -435,8 +413,6 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test12) { ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -462,11 +438,11 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test13) { sd::ops::log_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -474,8 +450,6 @@ TEST_F(DeclarableOpsTests11, log_loss_grad_test13) { ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test1) { @@ -645,14 +619,13 @@ TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test1) { sd::ops::resize_bicubic op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); - NDArray* result = results->at(0); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 30x30"); +// result.printBuffer("Resized to 30x30"); // expected.printBuffer("Expect for 30x30"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test2) { @@ -719,15 +692,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test2) { sd::ops::resize_bicubic op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 10x8"); +// result.printBuffer("Resized to 10x8"); // expected.printBuffer("Expect for 10x8"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test3) { @@ -756,15 +728,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test3) { sd::ops::resize_bicubic op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 6x6"); +// result.printBuffer("Resized to 6x6"); // expected.printBuffer("Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test4) { @@ -793,15 +764,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test4) { sd::ops::resize_bicubic op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 6x8"); +// result.printBuffer("Resized to 6x8"); // expected.printBuffer("Expect for 6x8"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test5) { @@ -836,15 +806,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test5) { sd::ops::resize_bicubic op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 8x8"); +// result.printBuffer("Resized to 8x8"); // expected.printBuffer("Expect for 8x8"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test6) { @@ -966,14 +935,13 @@ TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test6) { sd::ops::resize_bicubic op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); - NDArray* result = results->at(0); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 30x30"); +// result.printBuffer("Resized to 30x30"); // expected.printBuffer("Expect for 30x30"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test7) { @@ -1024,15 +992,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test7) { sd::ops::resize_bicubic op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 9x9"); +// result.printBuffer("Resized to 9x9"); // expected.printBuffer("Expect for 9x9"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test8) { @@ -1077,15 +1044,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeBicubic_Test8) { sd::ops::resize_bicubic op; auto results = op.evaluate({&input, &size}, {}, {}, {true, false}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Resized to 9x9"); +// result.printBuffer("Resized to 9x9"); // testData.printBuffer("Expect for 9x9"); ASSERT_TRUE(testData.isSameShape(result)); ASSERT_TRUE(testData.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test1) { @@ -1138,15 +1104,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test1) { sd::ops::resize_area op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x6"); +// result.printBuffer("Area Resized to 6x6"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test2) { @@ -1165,15 +1130,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test2) { sd::ops::resize_area op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x6"); +// result.printBuffer("Area Resized to 6x6"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } @@ -1193,15 +1157,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test3) { sd::ops::resize_area op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x6"); +// result.printBuffer("Area Resized to 6x6"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test4) { @@ -1231,15 +1194,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test4) { sd::ops::resize_area op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x6"); +// result.printBuffer("Area Resized to 6x6"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test5) { @@ -1269,15 +1231,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test5) { sd::ops::resize_area op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x6"); +// result.printBuffer("Area Resized to 6x6"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test6) { @@ -1307,15 +1268,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test6) { sd::ops::resize_area op; auto results = op.evaluate({&input, &size}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x6"); +// result.printBuffer("Area Resized to 6x6"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test7) { @@ -1345,15 +1305,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test7) { sd::ops::resize_area op; auto results = op.evaluate({&input}, {}, {6, 6}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x6"); +// result.printBuffer("Area Resized to 6x6"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test8) { @@ -1375,15 +1334,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test8) { sd::ops::resize_area op; auto results = op.evaluate({&input}, {}, {6, 6}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x6"); +// result.printBuffer("Area Resized to 6x6"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1402,15 +1360,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test9) { sd::ops::resize_area op; auto results = op.evaluate({&input, &size}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 10x10"); +// result.printBuffer("Area Resized to 10x10"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1429,15 +1386,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test10) { sd::ops::resize_area op; auto results = op.evaluate({&input}, {}, {10, 10}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 10x10"); +// result.printBuffer("Area Resized to 10x10"); // expected.printBuffer("Area Expect for 6x6"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1456,15 +1412,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test11) { sd::ops::resize_area op; auto results = op.evaluate({&input}, {}, {6, 9}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x9"); +// result.printBuffer("Area Resized to 6x9"); // expected.printBuffer("Area Expect for 6x6"); // ASSERT_TRUE(expected.isSameShape(result)); // ASSERT_TRUE(expected.equalsTo(result)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1483,15 +1438,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test12) { sd::ops::resize_area op; auto results = op.evaluate({&input}, {}, {10, 15}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 6x9"); +// result.printBuffer("Area Resized to 6x9"); // expected.printBuffer("Area Expect for 6x6"); // ASSERT_TRUE(expected.isSameShape(result)); // ASSERT_TRUE(expected.equalsTo(result)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1510,15 +1464,14 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test13) { sd::ops::resize_area op; auto results = op.evaluate({&input}, {}, {9, 9}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); + NDArray* result = results.at(0); -// result->printBuffer("Area Resized to 8x8"); +// result.printBuffer("Area Resized to 8x8"); // expected.printBuffer("Area Expect for 6x6"); // ASSERT_TRUE(expected.isSameShape(result)); // ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test14) { @@ -1541,14 +1494,13 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test14) { sd::ops::resize_area op; auto results = op.evaluate({&input, &size}, {}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); -// result->printBuffer("Area Resized to 8x7"); + NDArray* result = results.at(0); +// result.printBuffer("Area Resized to 8x7"); // expected.printBuffer("Area Expect for 8x7"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } TEST_F(DeclarableOpsTests11, ImageResizeArea_Test15) { @@ -1570,14 +1522,13 @@ TEST_F(DeclarableOpsTests11, ImageResizeArea_Test15) { sd::ops::resize_area op; auto results = op.evaluate({&input}, {}, {8, 7}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - NDArray* result = results->at(0); -// result->printBuffer("Area Resized to 8x7"); + NDArray* result = results.at(0); +// result.printBuffer("Area Resized to 8x7"); // expected.printBuffer("Area Expect for 8x7"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1619,13 +1570,12 @@ TEST_F(DeclarableOpsTests11, Solve_Test_1) { sd::ops::solve op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("Solve of 3x3"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; } //////////////////////////////////////////////////////////////////////////////// @@ -1649,13 +1599,13 @@ TEST_F(DeclarableOpsTests11, Solve_Test_2) { sd::ops::solve op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("Solve 4x4"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests11, Solve_Test_3) { @@ -1686,13 +1636,13 @@ TEST_F(DeclarableOpsTests11, Solve_Test_3) { sd::ops::solve op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("Solve 4x4"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -1718,14 +1668,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_4) { sd::ops::solve op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4 Solve 4x4"); // exp.printBuffer("4 Expec 4x4"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests11, Solve_Test_4_1) { @@ -1747,14 +1697,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_4_1) { sd::ops::solve op; auto res = op.evaluate({&a, &b}, {true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4 Solve 4x4"); // exp.printBuffer("4 Expec 4x4"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests11, Solve_Test_4_2) { @@ -1780,14 +1730,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_4_2) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}, {true, false}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4_2 Triangular_Solve 3x3"); // exp.printBuffer("4_2 Triangular_Expec 3x3"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -1814,14 +1764,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_4_3) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}, {true, true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4_3 Triangular_Solve 3x3"); // exp.printBuffer("4_3 Triangular_Expec 3x3"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -1848,14 +1798,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_4_4) { sd::ops::solve op; auto res = op.evaluate({&a, &b}, {false}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4_4 Solve 3x3"); // exp.printBuffer("4_4 Expec 3x3"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -1882,14 +1832,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_4_5) { sd::ops::solve op; auto res = op.evaluate({&a, &b}, {true, true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4_5 Solve 3x3"); // exp.printBuffer("4_5 Expec 3x3"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -1916,14 +1866,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_4_6) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}, {false, true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4_6 Solve 3x3"); // exp.printBuffer("4_6 Expec 3x3"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests11, Solve_Test_4_7) { @@ -1953,14 +1903,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_4_7) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}, {true, false}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4_7 Solve 3x3"); // exp.printBuffer("4_7 Expec 3x3"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -1987,14 +1937,14 @@ TEST_F(DeclarableOpsTests11, Solve_Test_5) { sd::ops::solve op; auto res = op.evaluate({&a, &b}, {true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printBuffer("4 Solve 4x4"); // exp.printBuffer("4 Expec 4x4"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests11, SolveLS_Test_1) { @@ -2015,14 +1965,13 @@ TEST_F(DeclarableOpsTests11, SolveLS_Test_1) { sd::ops::lstsq op; auto res = op.evaluate({&a, &b}, {0.5}, {}, {true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("LS Solve 2x2"); // exp.printIndexedBuffer("LS Expec 2x2"); ASSERT_TRUE(exp.equalsTo(z, 1.e-4)); - delete res; } TEST_F(DeclarableOpsTests11, SolveLS_Test_2) { @@ -2043,14 +1992,13 @@ TEST_F(DeclarableOpsTests11, SolveLS_Test_2) { sd::ops::lstsq op; auto res = op.evaluate({&a, &b}, {0.5}, {}, {true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("2LS Solve 2x2"); // exp.printIndexedBuffer("2LS Expec 2x2"); ASSERT_TRUE(exp.equalsTo(z, 1.e-4)); - delete res; } //////////////////////////////////////////////////////////////////////////////// @@ -2072,14 +2020,14 @@ TEST_F(DeclarableOpsTests11, Cholesky_Test_2x2x2) { sd::ops::cholesky op; auto res = op.evaluate({&a}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); z->printIndexedBuffer("L matrix is"); exp.printIndexedBuffer("L expected is"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2101,14 +2049,13 @@ TEST_F(DeclarableOpsTests11, Cholesky_Test_2x2x2_2) { sd::ops::cholesky op; auto res = op.evaluate({&a}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("L matrix is"); // exp.printIndexedBuffer("L expected is"); MmulHelper::matmul(z, z, &exp, false, true); ASSERT_TRUE(exp.equalsTo(a)); - delete res; } /////////////////////////////////////////////////////////////////// @@ -2130,11 +2077,11 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test1) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdp = results->at(0); - auto dLdw = results->at(1); - auto dLdl = results->at(2); + auto dLdp = results.at(0); + auto dLdw = results.at(1); + auto dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2143,7 +2090,6 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test1) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2162,14 +2108,13 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test2) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2190,11 +2135,11 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test3) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2203,7 +2148,6 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test3) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2222,14 +2166,13 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test4) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2251,11 +2194,11 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test5) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2264,7 +2207,6 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test5) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2283,14 +2225,13 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test6) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2309,14 +2250,13 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test7) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2342,11 +2282,11 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test8) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2355,7 +2295,6 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test8) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2377,11 +2316,11 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test9) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2390,7 +2329,6 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test9) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2409,14 +2347,13 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test10) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2435,14 +2372,13 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test11) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2468,11 +2404,11 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test12) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2481,7 +2417,6 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test12) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2505,11 +2440,11 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test13) { sd::ops::mean_sqerr_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2518,7 +2453,6 @@ TEST_F(DeclarableOpsTests11, mean_sqerr_loss_grad_test13) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } TEST_F(DeclarableOpsTests11, SquaredSubtractTest_Test1) { @@ -2527,10 +2461,10 @@ TEST_F(DeclarableOpsTests11, SquaredSubtractTest_Test1) { auto exp = NDArrayFactory::create('c', {4}, {9, 1,1, 9}); sd::ops::squaredsubtract op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } TEST_F(DeclarableOpsTests11, SquaredSubtractTest_Test2) { @@ -2539,9 +2473,9 @@ TEST_F(DeclarableOpsTests11, SquaredSubtractTest_Test2) { auto exp = NDArrayFactory::create('c', {2, 4}, {9, 1,1, 9, 9, 1, 1, 9}); sd::ops::squaredsubtract op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); - delete result; + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); + } TEST_F(DeclarableOpsTests11, SquaredSubtractTest_Test3) { @@ -2551,9 +2485,9 @@ TEST_F(DeclarableOpsTests11, SquaredSubtractTest_Test3) { auto eps = NDArrayFactory::create('c', {2, 4}, {1,2,3,4,5,6,7,8}); sd::ops::squaredsubtract_bp op; auto result = op.evaluate({&x, &y, &eps}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); - delete result; + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); + } /////////////////////////////////////////////////////////////////// @@ -2575,11 +2509,11 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test1) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdp = results->at(0); - auto dLdw = results->at(1); - auto dLdl = results->at(2); + auto dLdp = results.at(0); + auto dLdw = results.at(1); + auto dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2587,8 +2521,6 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test1) { ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -2607,14 +2539,13 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test2) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2635,11 +2566,11 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test3) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2648,7 +2579,6 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test3) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2667,14 +2597,13 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test4) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2696,11 +2625,11 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test5) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2709,7 +2638,6 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test5) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2728,14 +2656,13 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test6) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2754,14 +2681,13 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test7) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2787,11 +2713,11 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test8) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2800,7 +2726,6 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test8) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2822,11 +2747,11 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test9) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2835,7 +2760,6 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test9) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2854,14 +2778,13 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test10) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2880,14 +2803,13 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test11) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2913,11 +2835,11 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test12) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2926,7 +2848,6 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test12) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2950,11 +2871,11 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test13) { sd::ops::absolute_difference_loss_grad op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -2963,7 +2884,6 @@ TEST_F(DeclarableOpsTests11, absolute_difference_loss_grad_test13) { ASSERT_TRUE(dLdpExp.isSameShape(-*dLdl)); ASSERT_TRUE(dLdpExp.equalsTo(-*dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2979,12 +2899,11 @@ TEST_F(DeclarableOpsTests11, BFloat16_Test_1) { sd::ops::add op; auto results = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto res = results->at(0); + auto res = results.at(0); ASSERT_TRUE(res->equalsTo(exp)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3000,12 +2919,11 @@ TEST_F(DeclarableOpsTests11, BFloat16_Test_2) { sd::ops::add op; auto results = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto res = results->at(0); + auto res = results.at(0); ASSERT_TRUE(res->equalsTo(exp)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3021,12 +2939,10 @@ TEST_F(DeclarableOpsTests11, BFloat16_Test_3) { sd::ops::add op; auto results = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto res = results->at(0); + auto res = results.at(0); ASSERT_TRUE(res->equalsTo(exp)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -3050,11 +2966,11 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test1) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -3063,7 +2979,6 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test1) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3086,11 +3001,11 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test2) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -3099,7 +3014,6 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test2) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3122,11 +3036,11 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test3) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -3135,7 +3049,6 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test3) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3154,14 +3067,13 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test4) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3185,11 +3097,11 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test5) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -3198,7 +3110,6 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test5) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3217,14 +3128,13 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test6) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3243,14 +3153,13 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test7) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3277,11 +3186,11 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test8) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -3290,7 +3199,6 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test8) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3313,11 +3221,11 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test9) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -3326,7 +3234,6 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test9) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3345,14 +3252,13 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test10) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3371,14 +3277,13 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test11) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdw = results->at(1); + auto *dLdw = results.at(1); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3406,11 +3311,11 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test12) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -3419,7 +3324,6 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test12) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3444,11 +3348,11 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test13) { sd::ops::sigm_cross_entropy_loss_grad op; auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -3457,7 +3361,6 @@ TEST_F(DeclarableOpsTests11, sigm_cross_entropy_loss_grad_test13) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3473,12 +3376,10 @@ TEST_F(DeclarableOpsTests11, BFloat16_Test_4) { sd::ops::add op; auto results = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto res = results->at(0); + auto res = results.at(0); ASSERT_TRUE(res->equalsTo(exp)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -3494,12 +3395,11 @@ TEST_F(DeclarableOpsTests11, BFloat16_Test_5) { sd::ops::subtract op; auto results = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto res = results->at(0); + auto res = results.at(0); ASSERT_TRUE(res->equalsTo(exp)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -3515,12 +3415,10 @@ TEST_F(DeclarableOpsTests11, BFloat16_Test_6) { sd::ops::subtract op; auto results = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto res = results->at(0); + auto res = results.at(0); ASSERT_TRUE(res->equalsTo(exp)); - - delete results; } ///////////////////////////////////////////////////////////////// @@ -3540,18 +3438,16 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test1) { auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } ///////////////////////////////////////////////////////////////// @@ -3571,18 +3467,16 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test2) { auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } ///////////////////////////////////////////////////////////////// @@ -3602,18 +3496,16 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test3) { auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - - delete results; } ///////////////////////////////////////////////////////////////// @@ -3633,18 +3525,17 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test4) { auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3664,18 +3555,17 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test5) { auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3695,18 +3585,17 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test6) { auto results = op.evaluate({&logits, &weights, &labels}, {0.3}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3726,18 +3615,17 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test7) { auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3768,11 +3656,11 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test8) { auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); // dLdp->printIndexedBuffer(); @@ -3781,7 +3669,6 @@ TEST_F(DeclarableOpsTests11, softmax_cross_entropy_loss_grad_test8) { ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; } //////////////////////////////////////////////////////////////////////////////// @@ -3809,14 +3696,13 @@ TEST_F(DeclarableOpsTests11, softmaxCrossEntropyWithLogits_grad_test1) { auto results = op.evaluate({&logits, &labels}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3833,14 +3719,13 @@ TEST_F(DeclarableOpsTests11, softmaxCrossEntropyWithLogits_grad_test2) { auto results = op.evaluate({&logits, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3856,14 +3741,13 @@ TEST_F(DeclarableOpsTests11, softmaxCrossEntropyWithLogits_grad_test3) { auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3878,14 +3762,13 @@ TEST_F(DeclarableOpsTests11, softmaxCrossEntropyWithLogits_grad_test4) { auto results = op.evaluate({&logits, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3900,14 +3783,13 @@ TEST_F(DeclarableOpsTests11, softmaxCrossEntropyWithLogits_grad_test5) { auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3922,14 +3804,13 @@ TEST_F(DeclarableOpsTests11, softmaxCrossEntropyWithLogits_grad_test6) { auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3944,14 +3825,13 @@ TEST_F(DeclarableOpsTests11, softmaxCrossEntropyWithLogits_grad_test7) { auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3966,14 +3846,13 @@ TEST_F(DeclarableOpsTests11, softmaxCrossEntropyWithLogits_grad_test8) { auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -3993,13 +3872,12 @@ TEST_F(DeclarableOpsTests11, Multiply_BP_Test1) { auto results = op.evaluate({&x, &y, &dLdp}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdo = results->at(0); + auto *dLdo = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdo)); ASSERT_TRUE(dLdpExp.equalsTo(dLdo)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -4016,14 +3894,13 @@ TEST_F(DeclarableOpsTests11, sparseSoftmaxCrossEntropyWithLogits_grad_test1) { auto results = op.evaluate({&labels, &logits}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -4040,14 +3917,13 @@ TEST_F(DeclarableOpsTests11, sparseSoftmaxCrossEntropyWithLogits_grad_test2) { auto results = op.evaluate({&labels, &logits}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -4062,14 +3938,13 @@ TEST_F(DeclarableOpsTests11, sparseSoftmaxCrossEntropyWithLogits_grad_test3) { auto results = op.evaluate({&labels, &logits}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -4086,14 +3961,13 @@ TEST_F(DeclarableOpsTests11, sparseSoftmaxCrossEntropyWithLogits_grad_test4) { auto results = op.evaluate({&labels, &logits}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } ///////////////////////////////////////////////////////////////// @@ -4108,15 +3982,12 @@ TEST_F(DeclarableOpsTests11, sparseSoftmaxCrossEntropyWithLogits_grad_test5) { auto results = op.evaluate({&labels, &logits}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); + auto *dLdp = results.at(0); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); - delete results; } - - diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests12.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests12.cpp index 2b07f352d..615f95bbd 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests12.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests12.cpp @@ -46,12 +46,12 @@ TEST_F(DeclarableOpsTests12, test_any_validation_1) { sd::ops::transpose op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(x.dataType(), z->dataType()); - delete result; + } @@ -72,18 +72,18 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test1) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0, -1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); ASSERT_TRUE(dLdwExp.isSameShape(dLdw)); ASSERT_TRUE(dLdwExp.equalsTo(dLdw)); - delete results; + } ///////////////////////////////////////////////////////////////// @@ -104,11 +104,11 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test2) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -117,7 +117,7 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test2) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; + } ///////////////////////////////////////////////////////////////// @@ -138,11 +138,11 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test3) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -151,7 +151,7 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test3) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; + } ///////////////////////////////////////////////////////////////// @@ -172,11 +172,11 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test4) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -185,7 +185,7 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test4) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; + } @@ -207,11 +207,11 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test5) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -220,7 +220,7 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test5) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; + } ///////////////////////////////////////////////////////////////// @@ -241,11 +241,11 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test6) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -254,7 +254,7 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test6) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; + } ///////////////////////////////////////////////////////////////// @@ -277,11 +277,11 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test7) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -290,7 +290,7 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test7) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; + } ///////////////////////////////////////////////////////////////// @@ -313,11 +313,11 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test8) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -326,7 +326,7 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test8) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; + } ///////////////////////////////////////////////////////////////// @@ -349,11 +349,11 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test9) { auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0, 2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *dLdp = results->at(0); - auto *dLdw = results->at(1); - auto *dLdl = results->at(2); + auto *dLdp = results.at(0); + auto *dLdw = results.at(1); + auto *dLdl = results.at(2); ASSERT_TRUE(dLdpExp.isSameShape(dLdp)); ASSERT_TRUE(dLdpExp.equalsTo(dLdp)); @@ -362,7 +362,7 @@ TEST_F(DeclarableOpsTests12, cosine_distance_loss_grad_test9) { ASSERT_TRUE(dLdlExp.isSameShape(dLdl)); ASSERT_TRUE(dLdlExp.equalsTo(dLdl)); - delete results; + } @@ -585,13 +585,13 @@ TEST_F(DeclarableOpsTests12, reverse_test15) { sd::ops::reverse op; // auto result = op.execute({&x, &axis}, {}, {1}, {}); Nd4jStatus status = op.execute({&x, &axis}, {&z}, {}, {1}, {}); - // auto z = result->at(0); + // auto z = result.at(0); // z->printIndexedBuffer(); ASSERT_EQ(Status::OK(), status); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - // delete result; + // } ///////////////////////////////////////////////////////////////// @@ -721,14 +721,14 @@ TEST_F(DeclarableOpsTests12, reduceMeanBp_4) { sd::ops::reduce_mean_bp op; auto result = op.evaluate({&x, &gradO}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); // output->printShapeInfo(); // output->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -743,14 +743,14 @@ TEST_F(DeclarableOpsTests12, reduceMeanBp_5) { sd::ops::reduce_mean_bp op; auto result = op.evaluate({&x, &gradO}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); // output->printShapeInfo(); // output->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -761,9 +761,9 @@ TEST_F(DeclarableOpsTests12, reduceSqnormBp_1) { sd::ops::reduce_sqnorm_bp op; auto result = op.evaluate({&x, &gradO}, {1}, {2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -915,11 +915,11 @@ TEST_F(DeclarableOpsTests12, lrn_bp_1) { sd::ops::lrn_bp op; auto results = op.evaluate({&input, &gradO}, {1., 1., 1}, {5}); - auto gradI = results->at(0); + auto gradI = results.at(0); ASSERT_EQ(*gradI, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -946,11 +946,11 @@ TEST_F(DeclarableOpsTests12, lrn_bp_2) { sd::ops::lrn_bp op; auto results = op.evaluate({&input, &gradO}, {1., 1., 1}, {2}); - auto gradI = results->at(0); + auto gradI = results.at(0); ASSERT_EQ(*gradI, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -977,11 +977,11 @@ TEST_F(DeclarableOpsTests12, lrn_bp_3) { sd::ops::lrn_bp op; auto results = op.evaluate({&input, &gradO}, {1., 1., 1}, {7}); - auto gradI = results->at(0); + auto gradI = results.at(0); ASSERT_EQ(*gradI, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1008,11 +1008,11 @@ TEST_F(DeclarableOpsTests12, lrn_bp_4) { sd::ops::lrn_bp op; auto results = op.evaluate({&input, &gradO}, {1., 1., 1}, {12}); - auto gradI = results->at(0); + auto gradI = results.at(0); ASSERT_EQ(*gradI, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1031,11 +1031,11 @@ TEST_F(DeclarableOpsTests12, lrn_bp_5) { sd::ops::lrn_bp op; auto results = op.evaluate({&input, &gradO}, {1., 1., 0.5}, {2}); - auto gradI = results->at(0); + auto gradI = results.at(0); ASSERT_EQ(*gradI, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1050,11 +1050,11 @@ TEST_F(DeclarableOpsTests12, lrn_bp_6) { sd::ops::lrn_bp op; auto results = op.evaluate({&input, &gradO}, {1., 2., 0.5}, {10}); - auto gradI = results->at(0); + auto gradI = results.at(0); ASSERT_EQ(*gradI, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1104,14 +1104,14 @@ TEST_F(DeclarableOpsTests12, lrn_bp_9) { sd::ops::lrn_bp op; auto results = op.evaluate({&input, &gradO}, {1., 2., 0.5}, {3}); - auto gradI = results->at(0); + auto gradI = results.at(0); // for (int i = 0; i < exp.lengthOf(); ++i) // printf("%10.5f %10.5f\n", exp.e(i), gradI->e(i)); ASSERT_EQ(*gradI, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1124,11 +1124,11 @@ TEST_F(DeclarableOpsTests12, lrn_bp_10) { sd::ops::lrn_bp op; auto results = op.evaluate({&input, &gradO}, {1., 2., 0.5}, {1}); - auto gradI = results->at(0); + auto gradI = results.at(0); ASSERT_EQ(*gradI, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1145,11 +1145,11 @@ TEST_F(DeclarableOpsTests12, lrn_1) { sd::ops::lrn op; auto results = op.evaluate({&input}, {1., 2., 0.5}, {2}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_EQ(*output, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1161,10 +1161,10 @@ TEST_F(DeclarableOpsTests12, lrn_2) { sd::ops::lrn op; auto results = op.evaluate({&input}, {0.1, 2., 0.5}, {5}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_EQ(*output, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1176,10 +1176,10 @@ TEST_F(DeclarableOpsTests12, lrn_3) { sd::ops::lrn op; auto results = op.evaluate({&input}, {0.1, 2., 0.5}, {5}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_EQ(*output, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1191,10 +1191,10 @@ TEST_F(DeclarableOpsTests12, lrn_4) { sd::ops::lrn op; auto results = op.evaluate({&input}, {0.1, 2., 0.5}, {0}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_EQ(*output, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1206,10 +1206,10 @@ TEST_F(DeclarableOpsTests12, lrn_5) { sd::ops::lrn op; auto results = op.evaluate({&input}, {0.1, 2., 0.5}, {0}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_EQ(*output, exp); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1247,10 +1247,10 @@ TEST_F(DeclarableOpsTests12, inTopK_2) { auto res = op.evaluate({&input, &idx}, {}, {1}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - //res->at(0)->printIndexedBuffer("IN_TOP_K output"); - ASSERT_TRUE(res->at(0)->equalsTo(&exp)); - delete res; + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + //res.at(0)->printIndexedBuffer("IN_TOP_K output"); + ASSERT_TRUE(res.at(0)->equalsTo(&exp)); + } ////////////////////////////////////////////////////////////////////// @@ -1262,15 +1262,15 @@ TEST_F(DeclarableOpsTests12, inTopK_3) { sd::ops::in_top_k op; auto result = op.evaluate({&x, &y}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(1, result.size()); - auto v = result->at(0); + auto v = result.at(0); ASSERT_TRUE(expV.isSameShape(v)); ASSERT_TRUE(expV.equalsTo(v)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1282,15 +1282,15 @@ TEST_F(DeclarableOpsTests12, inTopK_4) { sd::ops::in_top_k op; auto result = op.evaluate({&x, &y}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(1, result.size()); - auto v = result->at(0); + auto v = result.at(0); ASSERT_TRUE(expV.isSameShape(v)); ASSERT_TRUE(expV.equalsTo(v)); - delete result; + } @@ -1303,15 +1303,15 @@ TEST_F(DeclarableOpsTests12, inTopK_5) { sd::ops::in_top_k op; auto result = op.evaluate({&x, &y}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(1, result.size()); - auto v = result->at(0); + auto v = result.at(0); ASSERT_TRUE(expV.isSameShape(v)); ASSERT_TRUE(expV.equalsTo(v)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -1324,14 +1324,14 @@ TEST_F(DeclarableOpsTests12, cube_1) { auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -1347,15 +1347,15 @@ TEST_F(DeclarableOpsTests12, cube_bp_1) { auto result = op.evaluate({&x, &gradO}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -1370,15 +1370,15 @@ TEST_F(DeclarableOpsTests12, pad_tests1) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -1397,15 +1397,15 @@ TEST_F(DeclarableOpsTests12, pad_tests2) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -1424,15 +1424,15 @@ TEST_F(DeclarableOpsTests12, pad_tests3) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -1455,9 +1455,9 @@ TEST_F(DeclarableOpsTests12, pad_tests4) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); @@ -1470,7 +1470,7 @@ TEST_F(DeclarableOpsTests12, pad_tests4) { // printf("%i : %f, %f\n", i, one, two); // } - delete results; + } @@ -1489,15 +1489,15 @@ TEST_F(DeclarableOpsTests12, pad_tests5) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -1516,15 +1516,15 @@ TEST_F(DeclarableOpsTests12, pad_tests6) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1542,15 +1542,15 @@ TEST_F(DeclarableOpsTests12, pad_tests7) sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1568,15 +1568,15 @@ TEST_F(DeclarableOpsTests12, pad_tests8) sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } ////////////////////////////////////////////////////////////////// @@ -1594,15 +1594,15 @@ TEST_F(DeclarableOpsTests12, pad_tests9) sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1617,14 +1617,14 @@ TEST_F(DeclarableOpsTests12, pad_tests10) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1639,14 +1639,14 @@ TEST_F(DeclarableOpsTests12, pad_tests11) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1667,15 +1667,15 @@ TEST_F(DeclarableOpsTests12, pad_tests12) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1689,15 +1689,15 @@ TEST_F(DeclarableOpsTests12, pad_tests13) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1711,14 +1711,14 @@ TEST_F(DeclarableOpsTests12, pad_tests14) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1732,14 +1732,14 @@ TEST_F(DeclarableOpsTests12, pad_tests15) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1753,14 +1753,14 @@ TEST_F(DeclarableOpsTests12, pad_tests16) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1774,14 +1774,14 @@ TEST_F(DeclarableOpsTests12, pad_tests17) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1795,14 +1795,14 @@ TEST_F(DeclarableOpsTests12, pad_tests18) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1816,14 +1816,14 @@ TEST_F(DeclarableOpsTests12, pad_tests19) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1837,14 +1837,14 @@ TEST_F(DeclarableOpsTests12, pad_tests20) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1859,15 +1859,15 @@ TEST_F(DeclarableOpsTests12, pad_tests21) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1882,15 +1882,15 @@ TEST_F(DeclarableOpsTests12, pad_tests22) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1905,16 +1905,16 @@ TEST_F(DeclarableOpsTests12, pad_tests23) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printShapeInfo("r"); // expected.printShapeInfo("e"); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1929,14 +1929,14 @@ TEST_F(DeclarableOpsTests12, pad_tests24) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1951,14 +1951,14 @@ TEST_F(DeclarableOpsTests12, pad_tests25) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1973,14 +1973,14 @@ TEST_F(DeclarableOpsTests12, pad_tests26) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -2032,9 +2032,9 @@ TEST_F(DeclarableOpsTests12, pad_tests29) { sd::ops::pad op; auto res = op.evaluate({&in, &pad}, {10.0}, {0}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - delete res; + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + ASSERT_TRUE(exp.equalsTo(res.at(0))); + } @@ -2049,9 +2049,9 @@ TEST_F(DeclarableOpsTests12, pad_tests30) { sd::ops::pad op; auto res = op.evaluate({&in, &pad}, {10.0}, {2}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - delete res; + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + ASSERT_TRUE(exp.equalsTo(res.at(0))); + } //////////////////////////////////////////////////////////////////////////////// @@ -2067,9 +2067,9 @@ TEST_F(DeclarableOpsTests12, pad_tests31) { sd::ops::pad op; auto res = op.evaluate({&in, &pad}, {10.0}, {1}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - delete res; + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + ASSERT_TRUE(exp.equalsTo(res.at(0))); + } /////////////////////////////////////////////////////////////////////////////// @@ -2083,9 +2083,9 @@ TEST_F(DeclarableOpsTests12, pad_tests32) { sd::ops::pad op; auto res = op.evaluate({&in, &pad}, {10.0}, {2}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - delete res; + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + ASSERT_TRUE(exp.equalsTo(res.at(0))); + } /////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests12, pad_tests33) { @@ -2106,9 +2106,9 @@ TEST_F(DeclarableOpsTests12, pad_tests33) { sd::ops::pad op; auto res = op.evaluate({&in, &pad}, {10.0}, {2}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - delete res; + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + ASSERT_TRUE(exp.equalsTo(res.at(0))); + } //////////////////////////////////////////////////////////////////// @@ -2142,15 +2142,15 @@ TEST_F(DeclarableOpsTests12, Pad_1) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -2169,15 +2169,15 @@ TEST_F(DeclarableOpsTests12, Pad_2) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -2196,15 +2196,15 @@ TEST_F(DeclarableOpsTests12, Pad_3) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -2223,15 +2223,15 @@ TEST_F(DeclarableOpsTests12, Pad_4) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -2250,15 +2250,15 @@ TEST_F(DeclarableOpsTests12, Pad_5) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -2277,15 +2277,15 @@ TEST_F(DeclarableOpsTests12, Pad_6) { sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -2303,15 +2303,15 @@ TEST_F(DeclarableOpsTests12, Pad_7) sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -2329,15 +2329,15 @@ TEST_F(DeclarableOpsTests12, Pad_8) sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } ////////////////////////////////////////////////////////////////// @@ -2355,15 +2355,15 @@ TEST_F(DeclarableOpsTests12, Pad_9) sd::ops::pad op; auto results = op.evaluate({&input, &paddings}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } TEST_F(DeclarableOpsTests12, Test_Expose_1) { @@ -2374,15 +2374,15 @@ TEST_F(DeclarableOpsTests12, Test_Expose_1) { auto result = op.evaluate({&input0, &input1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z0 = result->at(0); - auto z1 = result->at(1); + auto z0 = result.at(0); + auto z1 = result.at(1); ASSERT_TRUE(input0.equalsTo(z0)); ASSERT_TRUE(input1.equalsTo(z1)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2398,11 +2398,11 @@ TEST_F(DeclarableOpsTests12, Pad_SGO_Test_1) { sd::ops::pad op; auto res = op.evaluate({&in, &pad}, {10.0}, {0}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - // res->at(0)->printIndexedBuffer("PAD_SGO"); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + // res.at(0)->printIndexedBuffer("PAD_SGO"); // exp.printIndexedBuffer("PAD_EXP"); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - delete res; + ASSERT_TRUE(exp.equalsTo(res.at(0))); + } //////////////////////////////////////////////////////////////////////////////// @@ -2414,16 +2414,16 @@ TEST_F(DeclarableOpsTests12, LU_Test_1) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printIndexedBuffer("Triangulars"); // p->printIndexedBuffer("Permutaions"); ASSERT_TRUE(exp.equalsTo(z)); ASSERT_TRUE(pExp.equalsTo(p)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2435,14 +2435,14 @@ TEST_F(DeclarableOpsTests12, LU_Test_2) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printIndexedBuffer("Triangulars2"); // p->printIndexedBuffer("Permutaions2"); ASSERT_TRUE(expLU.equalsTo(z)); ASSERT_TRUE(expP.equalsTo(p)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2458,14 +2458,14 @@ TEST_F(DeclarableOpsTests12, LU_Test_3) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printIndexedBuffer("Triangulars3"); // p->printIndexedBuffer("Permutaions3"); ASSERT_TRUE(expLU.equalsTo(z)); ASSERT_TRUE(expP.equalsTo(p)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2500,16 +2500,16 @@ TEST_F(DeclarableOpsTests12, LU_Test_4) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printBuffer("Triangulars4"); // expLU.printBuffer("TriangulExp4"); // p->printBuffer("Permutaions4"); ASSERT_TRUE(expLU.equalsTo(z)); ASSERT_TRUE(expP.equalsTo(p)); - delete res; + } TEST_F(DeclarableOpsTests12, LU_Test_5) { @@ -2570,16 +2570,16 @@ TEST_F(DeclarableOpsTests12, LU_Test_5) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printBuffer("Triangulars5"); // expLU.printBuffer("TriangulExp5"); // p->printBuffer("Permutaions5"); ASSERT_TRUE(expLU.equalsTo(z)); ASSERT_TRUE(expP.equalsTo(p)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2591,13 +2591,13 @@ TEST_F(DeclarableOpsTests12, LU_Test_1_2) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printIndexedBuffer("Triangulars (2,3,3)"); // p->printIndexedBuffer("Permutaions (2,3,3)"); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - delete res; + ASSERT_TRUE(exp.equalsTo(res.at(0))); + } //////////////////////////////////////////////////////////////////////////////// @@ -2619,15 +2619,15 @@ TEST_F(DeclarableOpsTests12, LU_Test_3_2) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printIndexedBuffer("Triangulars3_2"); // p->printIndexedBuffer("Permutaions3_2"); ASSERT_TRUE(expLU.equalsTo(z)); ASSERT_TRUE(expP.equalsTo(p)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2647,15 +2647,15 @@ TEST_F(DeclarableOpsTests12, LU_Test_3_3) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printIndexedBuffer("Triangulars3_3"); // p->printIndexedBuffer("Permutaions3_3"); ASSERT_TRUE(expLU.equalsTo(z)); ASSERT_TRUE(expP.equalsTo(p)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2675,15 +2675,15 @@ TEST_F(DeclarableOpsTests12, LU_Test_4_1) { sd::ops::lu op; auto res = op.evaluate({&in}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); // z->printIndexedBuffer("Triangulars4_1"); // p->printIndexedBuffer("Permutaions4_1"); ASSERT_TRUE(expLU.equalsTo(z)); ASSERT_TRUE(expP.equalsTo(p)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2703,15 +2703,16 @@ TEST_F(DeclarableOpsTests12, LU_Test_4_2) { sd::ops::lu op; auto res = op.evaluate({&in}, {}, {sd::DataType::INT64}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); - auto p = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); + auto p = res.at(1); + // z->printIndexedBuffer("Triangulars4_2"); // p->printIndexedBuffer("Permutaions4_2"); ASSERT_TRUE(expLU.equalsTo(z)); ASSERT_TRUE(expP.equalsTo(p)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2729,9 +2730,9 @@ TEST_F(DeclarableOpsTests12, QR_Test_1) { sd::ops::qr op; auto res = op.evaluate({&in}, {}, {}, {true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto q = res->at(0); - auto r = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto q = res.at(0); + auto r = res.at(1); // q->printIndexedBuffer("Orthogonal 5x5"); // expQ.printBuffer("Orthogonal Exp"); // r->printIndexedBuffer("Upper triangular 5x3"); @@ -2740,14 +2741,13 @@ TEST_F(DeclarableOpsTests12, QR_Test_1) { // r->printShapeInfo("R shape"); sd::ops::matmul opMul; auto res2 = opMul.evaluate({q, r}); //MmulHelper::matmul(q, r, &in, false, false); - auto exp = res2->at(0);//->printIndexedBuffer("Result as result"); + auto exp = res2.at(0);//->printIndexedBuffer("Result as result"); ASSERT_TRUE(exp->isSameShape(in)); // ASSERT_TRUE(q->isSameShape(expQ)); //ASSERT_TRUE(expQ.equalsTo(q)); ASSERT_TRUE(exp->equalsTo(in)); - delete res2; - delete res; + } @@ -2776,9 +2776,9 @@ TEST_F(DeclarableOpsTests12, QR_Test_1_1) { sd::ops::qr op; auto res = op.evaluate({&in}, {}, {}, {true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto q = res->at(0); - auto r = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto q = res.at(0); + auto r = res.at(1); // q->printIndexedBuffer("Orthogonal 5x5"); // expQ.printBuffer("Orthogonal Exp"); // r->printIndexedBuffer("Upper triangular 5x3"); @@ -2787,14 +2787,13 @@ TEST_F(DeclarableOpsTests12, QR_Test_1_1) { // r->printShapeInfo("R shape"); sd::ops::matmul opMul; auto res2 = opMul.evaluate({q, r}); //MmulHelper::matmul(q, r, &in, false, false); - auto exp = res2->at(0);//->printIndexedBuffer("Result as result"); + auto exp = res2.at(0);//->printIndexedBuffer("Result as result"); ASSERT_TRUE(exp->isSameShape(in)); // ASSERT_TRUE(q->isSameShape(expQ)); //ASSERT_TRUE(expQ.equalsTo(q)); ASSERT_TRUE(exp->equalsTo(in)); - delete res2; - delete res; + } @@ -2808,19 +2807,18 @@ TEST_F(DeclarableOpsTests12, QR_Test_2) { sd::ops::qr op; auto res = op.evaluate({&in}, {}, {}, {false}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto q = res->at(0); - auto r = res->at(1); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto q = res.at(0); + auto r = res.at(1); ASSERT_TRUE(q->isSameShape(expQ)); ASSERT_TRUE(r->isSameShape(expR)); sd::ops::matmul opMul; auto res2 = opMul.evaluate({q, r}); //MmulHelper::matmul(q, r, &in, false, false); - auto exp = res2->at(0);//->printIndexedBuffer("Result as result"); + auto exp = res2.at(0);//->printIndexedBuffer("Result as result"); ASSERT_TRUE(exp->isSameShape(in)); ASSERT_TRUE(exp->equalsTo(in)); - delete res2; - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2843,13 +2841,13 @@ TEST_F(DeclarableOpsTests12, TriangularSolve_Test_1) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("TriangularSolve"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2872,13 +2870,13 @@ TEST_F(DeclarableOpsTests12, TriangularSolve_Test_2) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("TriangularSolve"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2909,13 +2907,13 @@ TEST_F(DeclarableOpsTests12, TriangularSolve_Test_3) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("TriangularSolve"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests12, TriangularSolve_Test_4) { @@ -2938,13 +2936,13 @@ TEST_F(DeclarableOpsTests12, TriangularSolve_Test_4) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}, {false}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("TriangularSolve"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2968,13 +2966,13 @@ TEST_F(DeclarableOpsTests12, TriangularSolve_Test_5) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}, {false, true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("TriangularSolve with adjoint"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2997,14 +2995,14 @@ TEST_F(DeclarableOpsTests12, SolveLs_Test_1) { sd::ops::lstsq op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("MatrixSolveLS"); MmulHelper::matmul(&a, z, &exp, false, false); ASSERT_TRUE(exp.equalsTo(b)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -3021,15 +3019,15 @@ TEST_F(DeclarableOpsTests12, SolveLs_Test_2) { sd::ops::lstsq op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); MmulHelper::matmul(&a, z, &exp, false, false); // z->printIndexedBuffer("MatrixSolveLS2"); ASSERT_TRUE(exp.equalsTo(b)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -3046,13 +3044,13 @@ TEST_F(DeclarableOpsTests12, SolveLs_Test_3) { sd::ops::lstsq op; auto res = op.evaluate({&a, &b}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("MatrixSolveLS3"); MmulHelper::matmul(&a, z, &exp, false, false); ASSERT_TRUE(exp.equalsTo(b)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -3069,8 +3067,8 @@ TEST_F(DeclarableOpsTests12, SolveLs_Test_4) { sd::ops::lstsq op; auto res = op.evaluate({&a, &b}, {false}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); // z->printIndexedBuffer("Output_12.4"); // z->printShapeInfo("Output_12.4 shape"); // MmulHelper::matmul(&a, z, &exp, false, false); @@ -3078,7 +3076,7 @@ TEST_F(DeclarableOpsTests12, SolveLs_Test_4) { // z->printIndexedBuffer("MatrixSolveLS4"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -3090,11 +3088,11 @@ TEST_F(DeclarableOpsTests12, SolveLs_Test_5) { sd::ops::lstsq op; auto res = op.evaluate({&a, &b}, {false}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); ASSERT_TRUE(z->isEmpty()); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -3106,11 +3104,11 @@ TEST_F(DeclarableOpsTests12, Solve_Test_6) { sd::ops::solve op; auto res = op.evaluate({&a, &b}, {true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); ASSERT_TRUE(z->isEmpty()); - delete res; + } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3134,11 +3132,11 @@ TEST_F(DeclarableOpsTests12, TriangularSolve_Test_6) { sd::ops::triangular_solve op; auto res = op.evaluate({&a, &b}, {}, {}, {false, true}); - ASSERT_EQ(res->status(), ND4J_STATUS_OK); - auto z = res->at(0); + ASSERT_EQ(res.status(), ND4J_STATUS_OK); + auto z = res.at(0); z->printIndexedBuffer("TriangularSolve with adjoint"); ASSERT_TRUE(exp.equalsTo(z)); - delete res; + } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests13.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests13.cpp index dcdffac6a..20665e5d3 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests13.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests13.cpp @@ -59,13 +59,11 @@ TEST_F(DeclarableOpsTests13, test_pow_1) { sd::ops::Pow op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - - delete result; } TEST_F(DeclarableOpsTests13, test_empty_range_1) { @@ -74,36 +72,32 @@ TEST_F(DeclarableOpsTests13, test_empty_range_1) { sd::ops::range op; auto result = op.evaluate({&start, &limit}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isEmpty()); - delete result; + } TEST_F(DeclarableOpsTests13, test_empty_range_2) { sd::ops::range op; auto result = op.evaluate({}, {1.0, 1.0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isEmpty()); - - delete result; } TEST_F(DeclarableOpsTests13, test_empty_range_3) { sd::ops::range op; auto result = op.evaluate({}, {1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isEmpty()); - - delete result; } TEST_F(DeclarableOpsTests13, test_argmax_edge_1) { @@ -153,9 +147,7 @@ TEST_F(DeclarableOpsTests13, test_greater_1) { sd::ops::greater op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } TEST_F(DeclarableOpsTests13, test_eval_reduction_shape_1) { @@ -166,13 +158,11 @@ TEST_F(DeclarableOpsTests13, test_eval_reduction_shape_1) { sd::ops::evaluate_reduction_shape op; auto result = op.evaluate({&x, &y}, {true}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(exp, *z); - - delete result; } TEST_F(DeclarableOpsTests13, test_or_1) { @@ -219,11 +209,9 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_GainsTest_1) { auto exp = NDArrayFactory::create('c', {2,3}, {1.2,2.2,3.2,4.2,5.2,6.2}); sd::ops::barnes_gains op; auto result = op.evaluate({&x, &y, &eps}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printBuffer("Gains out"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); - - delete result; + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printBuffer("Gains out"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); } TEST_F(DeclarableOpsTests13, BarnesHutTsne_GainsTest_2) { @@ -233,12 +221,11 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_GainsTest_2) { auto exp = NDArrayFactory::create('c', {2,3}, {1.2, 0.01, 3.2, 0.01, 5.2, 0.01}); sd::ops::barnes_gains op; auto result = op.evaluate({&x, &y, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printBuffer("Gains out"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printBuffer("Gains out"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); //ASSERT_EQ(e, z); - delete result; } TEST_F(DeclarableOpsTests13, BarnesHutTsne_GainsTest_3) { @@ -248,10 +235,10 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_GainsTest_3) { auto exp = NDArrayFactory::create('c', {2,3}, {0.01, 2.2, 0.01, 4.2, 0.01, 6.2}); sd::ops::barnes_gains op; auto result = op.evaluate({&x, &y, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printBuffer("Gains out"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); - delete result; + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printBuffer("Gains out"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); + } TEST_F(DeclarableOpsTests13, BarnesHutTsne_EdgeForceTest_1) { @@ -272,10 +259,10 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_EdgeForceTest_1) { auto result = op.evaluate({&rows, &cols, &vals, &data}, {}, {1}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printBuffer("Output"); - ASSERT_TRUE(exp1.equalsTo(result->at(0))); - delete result; + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printBuffer("Output"); + ASSERT_TRUE(exp1.equalsTo(result.at(0))); + } TEST_F(DeclarableOpsTests13, BarnesHutTsne_EdgeForceTest_2) { @@ -296,10 +283,10 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_EdgeForceTest_2) { auto result = op.evaluate({&rows, &cols, &vals, &data}, {}, {2}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printBuffer("Output"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); - delete result; + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printBuffer("Output"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); + } TEST_F(DeclarableOpsTests13, BarnesHutTsne_EdgeForceTest_3) { @@ -320,12 +307,12 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_EdgeForceTest_3) { auto result = op.evaluate({&rows, &cols, &vals, &data}, {}, {11}); //nd4j_printf("rows %lld, cols %lld, vals %lld, res full %lld\n", rows.lengthOf(), cols.lengthOf(), vals.lengthOf(), exp1.lengthOf()); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printBuffer("Output"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printBuffer("Output"); //exp.printBuffer("Expect"); - //result->at(0)->printShapeInfo("Shape output"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); - delete result; + //result.at(0)->printShapeInfo("Shape output"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); + } TEST_F(DeclarableOpsTests13, BarnesHutTsne_symmetrized_1) { @@ -341,11 +328,9 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_symmetrized_1) { // auto exp = NDArrayFactory::create('c', {2,3}, {1, 2, 1, 2, 2, 2}); sd::ops::barnes_symmetrized op; auto result = op.evaluate({&rows, &cols, &vals}, {}, {1}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(2)->printBuffer("Symmetrized1"); - ASSERT_TRUE(exp.equalsTo(result->at(2))); - - delete result; + ASSERT_EQ(result.status(), Status::OK()); + //result.at(2)->printBuffer("Symmetrized1"); + ASSERT_TRUE(exp.equalsTo(result.at(2))); } TEST_F(DeclarableOpsTests13, BarnesHutTsne_symmetrized_2) { @@ -360,11 +345,11 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_symmetrized_2) { // auto exp = NDArrayFactory::create('c', {2,3}, {1, 2, 1, 2, 2, 2}); sd::ops::barnes_symmetrized op; auto result = op.evaluate({&rows, &cols, &vals}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(2)->printBuffer("Symmetrized2"); - // ASSERT_TRUE(exp[i]->equalsTo(result->at(i))); - ASSERT_TRUE(exp.equalsTo(result->at(2))); - delete result; + ASSERT_EQ(result.status(), Status::OK()); + //result.at(2)->printBuffer("Symmetrized2"); + // ASSERT_TRUE(exp[i]->equalsTo(result.at(i))); + ASSERT_TRUE(exp.equalsTo(result.at(2))); + } TEST_F(DeclarableOpsTests13, BarnesHutTsne_symmetrized_3) { @@ -379,12 +364,12 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_symmetrized_3) { // auto exp = NDArrayFactory::create('c', {2,3}, {1, 2, 1, 2, 2, 2}); sd::ops::barnes_symmetrized op; auto result = op.evaluate({&rows, &cols, &vals}, {}, {11}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(2)->printBuffer("Symmetrized3"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(2)->printBuffer("Symmetrized3"); //exp.printBuffer("EXPect symm3"); - // ASSERT_TRUE(exp[i]->equalsTo(result->at(i))); - //ASSERT_TRUE(exp.equalsTo(result->at(0))); - delete result; + // ASSERT_TRUE(exp[i]->equalsTo(result.at(i))); + //ASSERT_TRUE(exp.equalsTo(result.at(0))); + } TEST_F(DeclarableOpsTests13, BarnesHutTsne_symmetrized_4) { @@ -403,17 +388,17 @@ TEST_F(DeclarableOpsTests13, BarnesHutTsne_symmetrized_4) { // auto exp = NDArrayFactory::create('c', {2,3}, {1, 2, 1, 2, 2, 2}); sd::ops::barnes_symmetrized op; auto result = op.evaluate({&rows, &cols, &vals}, {}, {11}); - ASSERT_EQ(result->status(), Status::OK()); - auto res = result->at(2); + ASSERT_EQ(result.status(), Status::OK()); + auto res = result.at(2); // res->printBuffer("Symmetrized4"); // exp4.printBuffer("Expected sym"); // nd4j_printf("Total res is {1, %lld}\n", res->lengthOf()); // nd4j_printf("Expected is {1, %lld}\n", exp4.lengthOf()); //exp.printBuffer("EXPect symm3"); - // ASSERT_TRUE(exp[i]->equalsTo(result->at(i))); + // ASSERT_TRUE(exp[i]->equalsTo(result.at(i))); ASSERT_TRUE(exp4.equalsTo(res)); - delete result; + } TEST_F(DeclarableOpsTests13, CellContains_test_1) { @@ -429,13 +414,13 @@ TEST_F(DeclarableOpsTests13, CellContains_test_1) { // auto exp = NDArrayFactory::create('c', {2,3}, {1, 2, 1, 2, 2, 2}); sd::ops::cell_contains op; auto result = op.evaluate({&corners, &width, &point}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(result->at(0)->e(0)); - //result->at(2)->printBuffer("Symmetrized3"); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(result.at(0)->e(0)); + //result.at(2)->printBuffer("Symmetrized3"); //exp.printBuffer("EXPect symm3"); - // ASSERT_TRUE(exp[i]->equalsTo(result->at(i))); - //ASSERT_TRUE(exp.equalsTo(result->at(0))); - delete result; + // ASSERT_TRUE(exp[i]->equalsTo(result.at(i))); + //ASSERT_TRUE(exp.equalsTo(result.at(0))); + } //////////////////////////////////////////////////////////////////// @@ -445,18 +430,17 @@ TEST_F(DeclarableOpsTests13, adjustHue_1) { NDArray factor = NDArrayFactory::create(0.5); NDArray exp ('c', {2,2,3}, {100,0,44, 208,5,220, 177,230,97, 2,255,244}, sd::DataType::FLOAT32); + sd::ops::adjust_hue op; - std::unique_ptr results (op.evaluate({&input, &factor}, {}, {2})); + auto results (op.evaluate({&input, &factor}, {}, {2})); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); - // result->printIndexedBuffer(); + auto result = results.at(0); + // result.printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - - } //////////////////////////////////////////////////////////////////// @@ -467,16 +451,14 @@ TEST_F(DeclarableOpsTests13, adjustHue_2) { sd::ops::adjust_hue op; - std::unique_ptr results(op.evaluate({&input}, {0.9}, {2})); + auto results(op.evaluate({&input}, {0.9}, {2})); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - - } @@ -487,16 +469,14 @@ TEST_F(DeclarableOpsTests13, adjustHue_3) { NDArray exp ('c', {2,2,3}, {0.,84.,100., 5.,220.,122.0001, 229.8,97.,230., 255.,142.8002,2.}, sd::DataType::FLOAT32); sd::ops::adjust_hue op; - std::unique_ptr results(op.evaluate({&input}, {-0.9}, {2})); + auto results(op.evaluate({&input}, {-0.9}, {2})); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - - } //////////////////////////////////////////////////////////////////// @@ -506,16 +486,14 @@ TEST_F(DeclarableOpsTests13, adjustHue_4) { NDArray exp ('c', {2,3,2}, {100,208, 0,5, 44,220, 177,2, 230,255, 97,244}, sd::DataType::FLOAT32); sd::ops::adjust_hue op; - std::unique_ptr results(op.evaluate({&input}, {0.5}, {1})); + auto results(op.evaluate({&input}, {0.5}, {1})); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - - } //////////////////////////////////////////////////////////////////// @@ -525,16 +503,15 @@ TEST_F(DeclarableOpsTests13, adjustHue_5) { NDArray exp ('c', {3,2,2}, {100,208, 177,2, 0,5, 230,255, 44,220, 97,244}, sd::DataType::FLOAT32); sd::ops::adjust_hue op; - std::unique_ptr results(op.evaluate({&input}, {0.5}, {0})); + auto results(op.evaluate({&input}, {0.5}, {0})); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - } //////////////////////////////////////////////////////////////////// @@ -547,14 +524,13 @@ TEST_F(DeclarableOpsTests13, adjustSaturation_1) { sd::ops::adjust_saturation op; auto results = op.evaluate({&input, &factor}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -566,16 +542,15 @@ TEST_F(DeclarableOpsTests13, adjustSaturation_2) { sd::ops::adjust_saturation op; auto results = op.evaluate({&input}, {10}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); -// result->printIndexedBuffer("Result2"); + auto result = results.at(0); +// result.printIndexedBuffer("Result2"); // exp.printIndexedBuffer("Expect2"); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -587,14 +562,13 @@ TEST_F(DeclarableOpsTests13, adjustSaturation_3) { sd::ops::adjust_saturation op; auto results = op.evaluate({&input}, {-10}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - delete results; } @@ -607,15 +581,14 @@ TEST_F(DeclarableOpsTests13, adjustSaturation_4) { sd::ops::adjust_saturation op; auto results = op.evaluate({&input}, {0.5}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); - // result->printIndexedBuffer(); + auto result = results.at(0); + // result.printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -627,14 +600,13 @@ TEST_F(DeclarableOpsTests13, adjustSaturation_5) { sd::ops::adjust_saturation op; auto results = op.evaluate({&input}, {0.5}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto result = results->at(0); + auto result = results.at(0); ASSERT_TRUE(exp.isSameShape(result)); ASSERT_TRUE(exp.equalsTo(result)); - delete results; } @@ -647,13 +619,12 @@ TEST_F(DeclarableOpsTests13, shift_bits_1) { sd::ops::shift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } TEST_F(DeclarableOpsTests13, rshift_bits_1) { @@ -665,13 +636,12 @@ TEST_F(DeclarableOpsTests13, rshift_bits_1) { sd::ops::rshift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } TEST_F(DeclarableOpsTests13, cyclic_shift_bits_1) { @@ -683,13 +653,12 @@ TEST_F(DeclarableOpsTests13, cyclic_shift_bits_1) { sd::ops::cyclic_shift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } TEST_F(DeclarableOpsTests13, cyclic_rshift_bits_1) { @@ -701,13 +670,12 @@ TEST_F(DeclarableOpsTests13, cyclic_rshift_bits_1) { sd::ops::cyclic_rshift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } TEST_F(DeclarableOpsTests13, shift_bits_2) { @@ -720,13 +688,12 @@ TEST_F(DeclarableOpsTests13, shift_bits_2) { sd::ops::shift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } TEST_F(DeclarableOpsTests13, rshift_bits_2) { @@ -739,13 +706,13 @@ TEST_F(DeclarableOpsTests13, rshift_bits_2) { sd::ops::rshift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests13, cyclic_shift_bits_2) { @@ -758,13 +725,12 @@ TEST_F(DeclarableOpsTests13, cyclic_shift_bits_2) { sd::ops::cyclic_shift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } TEST_F(DeclarableOpsTests13, cyclic_rshift_bits_2) { @@ -777,13 +743,12 @@ TEST_F(DeclarableOpsTests13, cyclic_rshift_bits_2) { sd::ops::cyclic_rshift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } TEST_F(DeclarableOpsTests13, shift_bits_3) { auto x = NDArrayFactory::create('c', {5, 5}); @@ -795,13 +760,12 @@ TEST_F(DeclarableOpsTests13, shift_bits_3) { sd::ops::shift_bits op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } //////////////////////////////////////////////////////////////////// @@ -818,14 +782,13 @@ TEST_F(DeclarableOpsTests13, space_to_batch_nd_1) { sd::ops::space_to_batch_nd op; auto result = op.evaluate({&x, &blockShape, &paddings}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } //////////////////////////////////////////////////////////////////// @@ -845,15 +808,14 @@ TEST_F(DeclarableOpsTests13, space_to_batch_nd_2) { sd::ops::space_to_batch_nd op; auto result = op.evaluate({&x, &blockShape, &paddings}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } //////////////////////////////////////////////////////////////////// @@ -876,15 +838,14 @@ TEST_F(DeclarableOpsTests13, space_to_batch_nd_3) { sd::ops::space_to_batch_nd op; auto result = op.evaluate({&x, &blockShape, &paddings}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } //////////////////////////////////////////////////////////////////// @@ -902,14 +863,13 @@ TEST_F(DeclarableOpsTests13, batch_to_space_nd_1) { sd::ops::batch_to_space_nd op; auto result = op.evaluate({&x, &blockShape, &crop}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } //////////////////////////////////////////////////////////////////// @@ -925,15 +885,14 @@ TEST_F(DeclarableOpsTests13, batch_to_space_nd_2) { sd::ops::batch_to_space_nd op; auto result = op.evaluate({&x, &blockShape, &crop}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } //////////////////////////////////////////////////////////////////// @@ -949,15 +908,14 @@ TEST_F(DeclarableOpsTests13, batch_to_space_nd_3) { sd::ops::batch_to_space_nd op; auto result = op.evaluate({&x, &blockShape, &crop}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -975,15 +933,14 @@ TEST_F(DeclarableOpsTests13, mergemax_1) { sd::ops::mergemax op; auto result = op.evaluate({&x1, &x2, &x3}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - delete result; } ////////////////////////////////////////////////////////////////////// @@ -1055,10 +1012,10 @@ TEST_F(DeclarableOpsTests13, lstmLayer_1) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *h = results->at(0); - auto *cL = results->at(2); + auto *h = results.at(0); + auto *cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1066,7 +1023,6 @@ TEST_F(DeclarableOpsTests13, lstmLayer_1) { ASSERT_TRUE(expClast.isSameShape(cL)); ASSERT_TRUE(expClast.equalsTo(cL)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1123,10 +1079,10 @@ TEST_F(DeclarableOpsTests13, lstmLayer_2) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *h = results->at(0); - auto *cL = results->at(2); + auto *h = results.at(0); + auto *cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1134,7 +1090,6 @@ TEST_F(DeclarableOpsTests13, lstmLayer_2) { ASSERT_TRUE(expClast.isSameShape(cL)); ASSERT_TRUE(expClast.equalsTo(cL)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1192,11 +1147,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_3) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1207,7 +1162,6 @@ TEST_F(DeclarableOpsTests13, lstmLayer_3) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; } @@ -1277,11 +1231,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_4) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1291,8 +1245,7 @@ TEST_F(DeclarableOpsTests13, lstmLayer_4) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1359,11 +1312,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_5) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); // h->printBuffer(); // hL->printBuffer(); @@ -1378,7 +1331,6 @@ TEST_F(DeclarableOpsTests13, lstmLayer_5) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1445,11 +1397,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_6) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1460,7 +1412,6 @@ TEST_F(DeclarableOpsTests13, lstmLayer_6) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1521,11 +1472,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_7) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI, &Wp}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1536,7 +1487,7 @@ TEST_F(DeclarableOpsTests13, lstmLayer_7) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; + #endif } @@ -1599,11 +1550,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_8) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI, &Wp}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1614,7 +1565,7 @@ TEST_F(DeclarableOpsTests13, lstmLayer_8) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; + #endif } @@ -1686,11 +1637,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_9) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &hI, &cI, &Wp}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1701,7 +1652,7 @@ TEST_F(DeclarableOpsTests13, lstmLayer_9) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; + #endif } @@ -1771,11 +1722,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_10) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &seqLen, &hI, &cI, &Wp}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1786,7 +1737,7 @@ TEST_F(DeclarableOpsTests13, lstmLayer_10) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; + #endif } @@ -1851,11 +1802,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_11) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &seqLen, &hI, &cI, &Wp}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1866,7 +1817,7 @@ TEST_F(DeclarableOpsTests13, lstmLayer_11) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; + #endif } @@ -1942,11 +1893,11 @@ TEST_F(DeclarableOpsTests13, lstmLayer_12) { sd::ops::lstmLayer op; auto results = op.evaluate({&x, &Wx, &Wr, &b, &seqLen, &hI, &cI, &Wp}, tArgs, iArgs, bArgs); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hL = results->at(1); - auto cL = results->at(2); + auto h = results.at(0); + auto hL = results.at(1); + auto cL = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -1957,7 +1908,7 @@ TEST_F(DeclarableOpsTests13, lstmLayer_12) { ASSERT_TRUE(expCL.isSameShape(cL)); ASSERT_TRUE(expCL.equalsTo(cL)); - delete results; + #endif } @@ -1979,15 +1930,15 @@ TEST_F(DeclarableOpsTests13, batchnorm_test1) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta}, {1e-5}, {1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); // output->printBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -2012,15 +1963,14 @@ TYPED_TEST(TypedDeclarableOpsTests13, batchnorm_test2) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta}, {1e-5}, {1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); // output->printBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2041,14 +1991,13 @@ TYPED_TEST(TypedDeclarableOpsTests13, batchnorm_test3) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta}, {1e-5}, {1,1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2069,14 +2018,13 @@ TYPED_TEST(TypedDeclarableOpsTests13, batchnorm_test4) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta}, {1e-5}, {1,1,0,2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2097,15 +2045,14 @@ TEST_F(DeclarableOpsTests13, batchnorm_test5) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta}, {1e-5}, {1, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); // output->printBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2126,14 +2073,14 @@ TEST_F(DeclarableOpsTests13, batchnorm_test6) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta}, {1e-5}, {1,1,3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -2195,14 +2142,13 @@ TEST_F(DeclarableOpsTests13, batchnorm_test8) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta}, {1e-5}, {1,1, 1,2,3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2238,15 +2184,15 @@ TEST_F(DeclarableOpsTests13, batchnorm_test9) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta}, {1e-5}, {1,1, 1,2,3,4}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); // output->printBuffer(); ASSERT_TRUE(expected.isSameShape(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -2273,11 +2219,11 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test1) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI)); @@ -2288,7 +2234,7 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test1) { ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - delete results; + } @@ -2316,11 +2262,11 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test2) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI)); @@ -2331,7 +2277,6 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test2) { ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2358,11 +2303,11 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test3) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1,0,2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI)); @@ -2373,7 +2318,6 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test3) { ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2397,11 +2341,11 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test4) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI)); @@ -2411,8 +2355,6 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test4) { ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2441,11 +2383,11 @@ return; auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI)); @@ -2455,8 +2397,6 @@ return; ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2486,11 +2426,11 @@ return; auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1,3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI)); @@ -2500,8 +2440,6 @@ return; ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - - delete results; } //////////////////////////////////////////////////////////////////// @@ -2534,11 +2472,11 @@ return; auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1,4}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); // dLdI->printBuffer(); @@ -2551,7 +2489,7 @@ return; ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -2583,11 +2521,11 @@ return; auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); // dLdI->printBuffer(); @@ -2600,7 +2538,6 @@ return; ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2637,11 +2574,11 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test9) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI, 1e-4)); @@ -2652,7 +2589,6 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test9) { ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2689,11 +2625,11 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test10) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1,3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI, 1e-4)); @@ -2704,7 +2640,6 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test10) { ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -2753,11 +2688,11 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test11) { auto results = op.evaluate({&input, &mean, &variance, &gamma, &beta, &gradO}, {1e-5}, {1,1, 1,2,3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto dLdI = results->at(0); - auto dLdG = results->at(3); - auto dLdB = results->at(4); + auto dLdI = results.at(0); + auto dLdG = results.at(3); + auto dLdB = results.at(4); ASSERT_TRUE(expdLdI.isSameShapeStrict(*dLdI)); ASSERT_TRUE(expdLdI.equalsTo(dLdI, 1e-4)); @@ -2768,5 +2703,4 @@ TEST_F(DeclarableOpsTests13, batchnorm_bp_test11) { ASSERT_TRUE(expdLdB.isSameShapeStrict(*dLdB)); ASSERT_TRUE(expdLdB.equalsTo(dLdB)); - delete results; -} \ No newline at end of file +} diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests14.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests14.cpp index 44dbf482d..b3a710be9 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests14.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests14.cpp @@ -45,13 +45,13 @@ TEST_F(DeclarableOpsTests14, Test_Validation_Edge_1) { sd::ops::fill op; auto result = op.evaluate({&x}, {4.0f}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(exp, *z); - delete result; + } TEST_F(DeclarableOpsTests14, Test_Reshape_CF_1) { @@ -63,11 +63,11 @@ TEST_F(DeclarableOpsTests14, Test_Reshape_CF_1) { sd::ops::reshape op; auto result = op.evaluate({&x}, {3, 2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); - delete result; + } TEST_F(DeclarableOpsTests14, Test_Inf_Comparison_1) { @@ -102,13 +102,13 @@ TEST_F(DeclarableOpsTests14, Multiply_test) { sd::ops::multiply op; auto result = op.evaluate({&x, &y}); - auto f = result->at(0); + auto f = result.at(0); NDArray r = *f; ASSERT_EQ(e, r); ASSERT_EQ(e, *f); - delete result; + } } @@ -119,12 +119,12 @@ TEST_F(DeclarableOpsTests14, Test_EvalReductionShape_1) { sd::ops::evaluate_reduction_shape op; auto result = op.evaluate({&x, &y}, {}, {}, {false, false}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests14, Test_EvalReductionShape_2) { @@ -134,12 +134,12 @@ TEST_F(DeclarableOpsTests14, Test_EvalReductionShape_2) { sd::ops::evaluate_reduction_shape op; auto result = op.evaluate({&x, &y}, {}, {}, {true, false}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests14, Test_Reduce_Min_Small_0) { @@ -189,11 +189,11 @@ TEST_F(DeclarableOpsTests14, Test_scalar_broadcast_1) { sd::ops::add op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(e, *result->at(0)); + ASSERT_EQ(e, *result.at(0)); - delete result; + } TEST_F(DeclarableOpsTests14, Test_scalar_broadcast_2) { @@ -206,11 +206,11 @@ TEST_F(DeclarableOpsTests14, Test_scalar_broadcast_2) { sd::ops::subtract op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(e, *result->at(0)); + ASSERT_EQ(e, *result.at(0)); - delete result; + } TEST_F(DeclarableOpsTests14, test_empty_fill_1) { @@ -219,12 +219,12 @@ TEST_F(DeclarableOpsTests14, test_empty_fill_1) { sd::ops::fill op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(y, *z); - delete result; + } TEST_F(DeclarableOpsTests14, test_lstmBlockCell_1) { @@ -255,11 +255,11 @@ TEST_F(DeclarableOpsTests14, test_empty_reduce_min_1) { auto e = NDArrayFactory::create('c', {1, 0}); sd::ops::reduce_min sumOp; auto res2 = sumOp.evaluate({&e}, {1.}, {1}); - ASSERT_EQ(res2->status(), Status::OK()); - auto out = res2->at(0); + ASSERT_EQ(res2.status(), Status::OK()); + auto out = res2.at(0); ASSERT_EQ(out->e(0), DataTypeUtils::infOrMax()); - delete res2; + } TEST_F(DeclarableOpsTests14, test_empty_reduce_max_1) { @@ -267,11 +267,11 @@ TEST_F(DeclarableOpsTests14, test_empty_reduce_max_1) { auto e = NDArrayFactory::create('c', {1, 0}); sd::ops::reduce_max sumOp; auto res2 = sumOp.evaluate({&e}, {1.}, {1}); - ASSERT_EQ(res2->status(), Status::OK()); - auto out = res2->at(0); + ASSERT_EQ(res2.status(), Status::OK()); + auto out = res2.at(0); ASSERT_EQ(out->e(0), -DataTypeUtils::infOrMax()); - delete res2; + } TEST_F(DeclarableOpsTests14, test_empty_reduce_sum_1) { @@ -283,10 +283,10 @@ TEST_F(DeclarableOpsTests14, test_empty_reduce_sum_1) { auto e = NDArrayFactory::create('c', {1, 0}); sd::ops::reduce_sum sumOp; auto res2 = sumOp.evaluate({&e}, {1.}, {1}); - ASSERT_EQ(res2->status(), Status::OK()); - auto out = res2->at(0); + ASSERT_EQ(res2.status(), Status::OK()); + auto out = res2.at(0); ASSERT_EQ(out->e(0), 0.f); - delete res2; + } TEST_F(DeclarableOpsTests14, test_empty_reduce_mean_1) { @@ -298,12 +298,12 @@ TEST_F(DeclarableOpsTests14, test_empty_reduce_mean_1) { auto e = NDArrayFactory::create('c', {1, 0}); sd::ops::reduce_mean sumOp; auto res2 = sumOp.evaluate({&e}, {1.}, {1}); - ASSERT_EQ(res2->status(), Status::OK()); - auto out = res2->at(0); + ASSERT_EQ(res2.status(), Status::OK()); + auto out = res2.at(0); // out->printShapeInfo("ReduceMean empty shape with keep dims"); // out->printIndexedBuffer("ReduceMean scalar"); ASSERT_TRUE(std::isnan(out->e(0))); - delete res2; + } TEST_F(DeclarableOpsTests14, Test_StridedSliceZeros_1) { @@ -318,13 +318,13 @@ TEST_F(DeclarableOpsTests14, Test_StridedSliceZeros_1) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {0, 0, 0, 0, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } TEST_F(DeclarableOpsTests14, Test_StridedSliceZeros_2) { @@ -339,13 +339,13 @@ TEST_F(DeclarableOpsTests14, Test_StridedSliceZeros_2) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } TEST_F(DeclarableOpsTests14, test_empty_argmax_1) { @@ -357,13 +357,13 @@ TEST_F(DeclarableOpsTests14, test_empty_argmax_1) { //sd::ops::reduce_max op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests14, test_empty_argmax_2) { @@ -384,14 +384,14 @@ TEST_F(DeclarableOpsTests14, test_empty_tanh_5) { sd::ops::tanh op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x.isSameShape(z)); ASSERT_EQ(x, *z); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -402,14 +402,14 @@ TEST_F(DeclarableOpsTests14, repeat_1) { sd::ops::repeat op; auto result = op.evaluate({&x}, {}, {2, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -420,14 +420,14 @@ TEST_F(DeclarableOpsTests14, repeat_2) { sd::ops::repeat op; auto result = op.evaluate({&x}, {}, {2, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -438,14 +438,14 @@ TEST_F(DeclarableOpsTests14, repeat_3) { sd::ops::repeat op; auto result = op.evaluate({&x}, {}, {1,2,3, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -456,14 +456,14 @@ TEST_F(DeclarableOpsTests14, repeat_4) { sd::ops::repeat op; auto result = op.evaluate({&x}, {}, {3,4, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -474,14 +474,14 @@ TEST_F(DeclarableOpsTests14, repeat_5) { sd::ops::repeat op; auto result = op.evaluate({&x}, {}, {1,2,1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - delete result; + } ///////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, Test_broadcast_SpecialCaseTest) { @@ -496,13 +496,13 @@ TEST_F(DeclarableOpsTests14, Test_broadcast_SpecialCaseTest) { sd::ops::add op; auto result = op.evaluate({ &x, &y }); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto res = *result->at(0); + auto res = *result.at(0); ASSERT_EQ(e, res); - delete result; + } ///////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, Test_broadcast_SpecialCaseTest2) { @@ -517,13 +517,13 @@ TEST_F(DeclarableOpsTests14, Test_broadcast_SpecialCaseTest2) { sd::ops::add op; auto result = op.evaluate({ &x, &y }); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto res = *result->at(0); + auto res = *result.at(0); ASSERT_EQ(e, res); - delete result; + } /////////////////////////////////////////////////////////////////////// @@ -633,13 +633,13 @@ TEST_F(DeclarableOpsTests14, matmul_test1) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } @@ -655,13 +655,13 @@ TEST_F(DeclarableOpsTests14, matmul_test2) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -676,13 +676,13 @@ TEST_F(DeclarableOpsTests14, matmul_test3) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } @@ -698,13 +698,13 @@ TEST_F(DeclarableOpsTests14, matmul_test4) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } @@ -720,13 +720,13 @@ TEST_F(DeclarableOpsTests14, matmul_test5) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -741,13 +741,13 @@ TEST_F(DeclarableOpsTests14, matmul_test6) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -764,13 +764,13 @@ TEST_F(DeclarableOpsTests14, matmul_test7) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {0, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -789,13 +789,13 @@ TEST_F(DeclarableOpsTests14, matmul_test8) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {0, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -814,13 +814,13 @@ TEST_F(DeclarableOpsTests14, matmul_test9) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } TEST_F(DeclarableOpsTests14, matmul_test10) { @@ -870,13 +870,13 @@ TEST_F(DeclarableOpsTests14, matmul_test11) { auto result = op.evaluate({&A, &B}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests14, matmul_test12) { @@ -886,15 +886,15 @@ TEST_F(DeclarableOpsTests14, matmul_test12) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}, {}, {1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -905,16 +905,16 @@ TEST_F(DeclarableOpsTests14, matmul_test13) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}, {}, {1, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests14, matmul_test14) { @@ -924,16 +924,16 @@ TEST_F(DeclarableOpsTests14, matmul_test14) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}, {}, {0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests14, matmul_test15) { @@ -943,16 +943,16 @@ TEST_F(DeclarableOpsTests14, matmul_test15) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests14, matmul_test16) { @@ -962,16 +962,16 @@ TEST_F(DeclarableOpsTests14, matmul_test16) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests14, matmul_test17) { @@ -981,11 +981,11 @@ TEST_F(DeclarableOpsTests14, matmul_test17) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(exp, *result->at(0)); + ASSERT_EQ(exp, *result.at(0)); - delete result; + } @@ -1001,13 +1001,13 @@ TEST_F(DeclarableOpsTests14, matmul_test18) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1021,13 +1021,13 @@ TEST_F(DeclarableOpsTests14, matmul_test19) { y.linspace(0.5, 0.5); sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 1}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto z = results->at(0); + auto z = results.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1043,12 +1043,12 @@ TEST_F(DeclarableOpsTests14, matmul_test20) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 1}); - ASSERT_EQ(Status::OK(), results->status()); - auto z = results->at(0); + ASSERT_EQ(Status::OK(), results.status()); + auto z = results.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1063,13 +1063,13 @@ TEST_F(DeclarableOpsTests14, matmul_test21) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {0, 0, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1084,13 +1084,13 @@ TEST_F(DeclarableOpsTests14, matmul_test22) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 0, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1105,13 +1105,13 @@ TEST_F(DeclarableOpsTests14, matmul_test23) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 0, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1129,13 +1129,13 @@ TEST_F(DeclarableOpsTests14, matmul_test24) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 1, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1150,13 +1150,13 @@ TEST_F(DeclarableOpsTests14, matmul_test25) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 0}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1171,13 +1171,13 @@ TEST_F(DeclarableOpsTests14, matmul_test26) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {0, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1192,13 +1192,13 @@ TEST_F(DeclarableOpsTests14, matmul_test27) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } @@ -1214,13 +1214,13 @@ TEST_F(DeclarableOpsTests14, matmul_test28) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1,1,1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } @@ -1236,13 +1236,13 @@ TEST_F(DeclarableOpsTests14, matmul_test29) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, matmul_test30) { @@ -1256,13 +1256,13 @@ TEST_F(DeclarableOpsTests14, matmul_test30) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, matmul_test31) { @@ -1276,13 +1276,13 @@ TEST_F(DeclarableOpsTests14, matmul_test31) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, matmul_test32) { @@ -1293,13 +1293,13 @@ TEST_F(DeclarableOpsTests14, matmul_test32) { sd::ops::matmul op; auto results = op.evaluate({&x, &y}, {}, {1, 1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete results; + } ///////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, matmul_test33) { @@ -1312,14 +1312,14 @@ TEST_F(DeclarableOpsTests14, matmul_test33) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}, {}, {1, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, matmul_test34) { @@ -1329,14 +1329,14 @@ TEST_F(DeclarableOpsTests14, matmul_test34) { sd::ops::matmul op; auto result = op.evaluate({&a, &b}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ///////////////////////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, matmul_test35) { @@ -1346,14 +1346,14 @@ TEST_F(DeclarableOpsTests14, matmul_test35) { sd::ops::matmul op; auto result = op.evaluate({&a, &b}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, matmul_test36) { @@ -1363,14 +1363,14 @@ TEST_F(DeclarableOpsTests14, matmul_test36) { sd::ops::matmul op; auto result = op.evaluate({&a, &b}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests14, matmul_test37) { @@ -1612,12 +1612,12 @@ TEST_F(DeclarableOpsTests14, Stack_1) { sd::ops::stack op; auto results = op.evaluate({&input1, &input2}, {}, {0}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } @@ -1640,12 +1640,12 @@ TEST_F(DeclarableOpsTests14, Stack_2) { sd::ops::stack op; auto results = op.evaluate({&input1, &input2}, {}, {1}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } @@ -1668,12 +1668,12 @@ TEST_F(DeclarableOpsTests14, Stack_3) { sd::ops::stack op; auto results = op.evaluate({&input1, &input2}, {}, {0}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1695,12 +1695,12 @@ TEST_F(DeclarableOpsTests14, Stack_4) { sd::ops::stack op; auto results = op.evaluate({&input1, &input2}, {}, {1}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1722,12 +1722,12 @@ TEST_F(DeclarableOpsTests14, Stack_5) { sd::ops::stack op; auto results = op.evaluate({&input1, &input2}, {}, {0}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1749,12 +1749,12 @@ TEST_F(DeclarableOpsTests14, Stack_6) { sd::ops::stack op; auto results = op.evaluate({&input1, &input2}, {}, {1}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } @@ -1773,12 +1773,12 @@ TEST_F(DeclarableOpsTests14, Stack_7) { sd::ops::stack op; auto results = op.evaluate({&input1, &input1, &input1}, {}, {0}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1796,12 +1796,12 @@ TEST_F(DeclarableOpsTests14, Stack_8) { sd::ops::stack op; auto results = op.evaluate({&input1, &input1, &input1}, {}, {0}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1819,12 +1819,12 @@ TEST_F(DeclarableOpsTests14, Stack_9) { sd::ops::stack op; auto results = op.evaluate({&input1, &input1, &input1}, {}, {1}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1842,7 +1842,7 @@ TEST_F(DeclarableOpsTests14, Stack_10) { sd::ops::stack op; auto results = op.evaluate({&input1, &input1, &input1}, {}, {1}); - auto output = results->at(0); + auto output = results.at(0); //expected.printShapeInfo("exp"); //output->printShapeInfo("out"); @@ -1850,7 +1850,7 @@ TEST_F(DeclarableOpsTests14, Stack_10) { ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } TEST_F(DeclarableOpsTests14, Stack_11) { @@ -1867,12 +1867,12 @@ TEST_F(DeclarableOpsTests14, Stack_11) { sd::ops::stack op; auto results = op.evaluate({&input1, &input1, &input1}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } @@ -1888,14 +1888,14 @@ TEST_F(DeclarableOpsTests14, Stack_12) { sd::ops::stack op; auto result = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1910,14 +1910,14 @@ TEST_F(DeclarableOpsTests14, Stack_13) { sd::ops::stack op; auto result = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1932,16 +1932,16 @@ TEST_F(DeclarableOpsTests14, Stack_14) { sd::ops::stack op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printShapeInfo(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests14, Stack_15) { @@ -1952,14 +1952,14 @@ TEST_F(DeclarableOpsTests14, Stack_15) { sd::ops::stack op; auto result = op.evaluate({&t, &u, &v}, {}, {-4}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } @@ -1971,14 +1971,14 @@ TEST_F(DeclarableOpsTests14, Stack_16) { sd::ops::stack op; auto result = op.evaluate({&t, &u, &v}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests14, Stack_17) { @@ -1990,16 +1990,16 @@ TEST_F(DeclarableOpsTests14, Stack_17) { sd::ops::stack op; auto result = op.evaluate({&t, &u, &v, &w}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests14, Stack_18) { @@ -2008,18 +2008,18 @@ TEST_F(DeclarableOpsTests14, Stack_18) { sd::ops::stack op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); sd::ops::reduce_min sumOp; auto res2 = sumOp.evaluate({&e}, {1.}, {1}); - ASSERT_EQ(res2->status(), Status::OK()); - auto out = res2->at(0); + ASSERT_EQ(res2.status(), Status::OK()); + auto out = res2.at(0); ASSERT_EQ(out->e(0), DataTypeUtils::infOrMax()); - delete res2; - delete result; + + } TEST_F(DeclarableOpsTests14, Stack_19) { @@ -2028,12 +2028,12 @@ TEST_F(DeclarableOpsTests14, Stack_19) { sd::ops::stack op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests14, Stack_20) { @@ -2042,12 +2042,12 @@ TEST_F(DeclarableOpsTests14, Stack_20) { sd::ops::stack op; auto result = op.evaluate({&x, &x}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests14, Stack_21) { @@ -2059,23 +2059,21 @@ TEST_F(DeclarableOpsTests14, Stack_21) { sd::ops::stack opStack; auto resultStack = opStack.evaluate({&x1, &x2}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, resultStack->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultStack.status()); sd::ops::concat opConcat; auto resultConcat = opConcat.evaluate({&x1, &x2}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, resultConcat->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultConcat.status()); - auto outStack = resultStack->at(0); - auto outConcat = resultConcat->at(0); + auto outStack = resultStack.at(0); + auto outConcat = resultConcat.at(0); outConcat->reshapei({2,3,2}); ASSERT_TRUE(outStack->isSameShape(outConcat)); ASSERT_TRUE(outStack->equalsTo(outConcat)); - delete resultStack; - delete resultConcat; } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests15.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests15.cpp index 4a5ea659a..f983d27a3 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests15.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests15.cpp @@ -88,8 +88,8 @@ TEST_F(DeclarableOpsTests15, Test_standarize_bp_1) { sd::ops::standardize_bp op; auto result = op.evaluate({&x, &eps}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - delete result; + ASSERT_EQ(Status::OK(), result.status()); + } TEST_F(DeclarableOpsTests15, Test_AdjustContrast_1) { @@ -104,11 +104,11 @@ TEST_F(DeclarableOpsTests15, Test_AdjustContrast_1) { x.linspace(1.); sd::ops::adjust_contrast op; auto result = op.evaluate({&x, &factor}, {}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); ASSERT_TRUE(e.equalsTo(out)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_AdjustContrast_2) { @@ -122,11 +122,11 @@ TEST_F(DeclarableOpsTests15, Test_AdjustContrast_2) { x.linspace(1.); sd::ops::adjust_contrast op; auto result = op.evaluate({&x}, {2.}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); // out->printIndexedBuffer("Adjusted Constrast"); ASSERT_TRUE(e.equalsTo(out)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_AdjustContrast_3) { @@ -140,11 +140,11 @@ TEST_F(DeclarableOpsTests15, Test_AdjustContrast_3) { x.linspace(1.); sd::ops::adjust_contrast_v2 op; auto result = op.evaluate({&x}, {2.}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); // out->printIndexedBuffer("Adjusted Constrast"); ASSERT_TRUE(e.equalsTo(out)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_AdjustContrast_4) { @@ -158,11 +158,11 @@ TEST_F(DeclarableOpsTests15, Test_AdjustContrast_4) { x.linspace(1.); sd::ops::adjust_contrast_v2 op; auto result = op.evaluate({&x}, {2.}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); // out->printIndexedBuffer("Adjusted Constrast"); ASSERT_TRUE(e.equalsTo(out)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_AdjustContrast_5) { @@ -173,11 +173,11 @@ TEST_F(DeclarableOpsTests15, Test_AdjustContrast_5) { x.linspace(1.); sd::ops::adjust_contrast_v2 op; auto result = op.evaluate({&x}, {2.}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); // out->printIndexedBuffer("Adjusted Constrast"); ASSERT_TRUE(e.equalsTo(out)); - delete result; + } /* @@ -303,12 +303,12 @@ TEST_F(DeclarableOpsTests15, Test_AdjustContrast_6) { sd::ops::adjust_contrast op; auto result = op.evaluate({&x}, {2.}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); // out->printBuffer("Adjusted Constrast6"); // e.printBuffer("Adjusted Expected 6"); // ASSERT_TRUE(e.equalsTo(out)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_AdjustContrast_7) { @@ -408,27 +408,28 @@ TEST_F(DeclarableOpsTests15, Test_AdjustContrast_7) { // x.linspace(1.); sd::ops::adjust_contrast_v2 op; auto result = op.evaluate({&x}, {2.}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); // out->printBuffer("Adjusted Constrast7"); // e.printBuffer("Adjusted expected 7"); auto diff = e - *out; // diff.printBuffer("Adjusted subtract 7"); ASSERT_TRUE(e.equalsTo(out)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_BitCast_1) { auto x = NDArrayFactory::create('c', {2, 2, 2}); auto e = NDArrayFactory::create('c', {2, 2}, {2., 512., 8192., 131072.032 }); x.linspace(1.); + sd::ops::bitcast op; auto result = op.evaluate({&x}, {(int) sd::DataType::DOUBLE}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); // out->printIndexedBuffer("Casted result"); ASSERT_TRUE(e.equalsTo(out)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_BitCast_2) { @@ -436,12 +437,14 @@ TEST_F(DeclarableOpsTests15, Test_BitCast_2) { auto e = NDArrayFactory::create('c', {2, 4, 2}, {0.f, 1.875f, 0.f, 2.f, 0.f, 2.125f, 0.f, 2.25f, 0.f, 2.312f, 0.f, 2.375f, 0.f, 2.438f, 0.f, 2.5f}); x.linspace(1.); + sd::ops::bitcast op; auto result = op.evaluate({&x}, {(int) sd::DataType::HALF}); - ASSERT_EQ(Status::OK(), result->status()); - auto out = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto out = result.at(0); + ASSERT_TRUE(e.equalsTo(out)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_BitCast_3) { @@ -451,8 +454,8 @@ TEST_F(DeclarableOpsTests15, Test_BitCast_3) { sd::ops::bitcast op; try { auto result = op.evaluate({&x}, {(int) sd::DataType::INT64}); - ASSERT_NE(Status::OK(), result->status()); - delete result; + ASSERT_NE(Status::OK(), result.status()); + } catch (std::exception& e) { nd4j_printf("Error should be here `%s'. It's OK.\n", e.what()); } @@ -479,11 +482,12 @@ TEST_F(DeclarableOpsTests15, Test_BitCast_4_1) { sd::ops::bitcast op; auto result = op.evaluate({&x}, {}, {sd::DataType::INT64}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); + // e.printIndexedBuffer("Double to int64"); - auto res = result->at(0); + auto res = result.at(0); ASSERT_EQ(*res, e); - delete result; + } @@ -496,13 +500,15 @@ TEST_F(DeclarableOpsTests15, Test_BitCast_5) { auto e = NDArrayFactory::create('c', {4}, {4260467851820808160LL, 3900173902914993008LL, 3566895990128523424LL, 3314989625590692528LL}); + sd::ops::bitcast op; auto result = op.evaluate({&x}, {}, {sd::DataType::INT64}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto res = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto res = result.at(0); + // res->printIndexedBuffer("BITCAST5"); ASSERT_TRUE(e.equalsTo(res)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_BitCast_6) { @@ -514,13 +520,15 @@ TEST_F(DeclarableOpsTests15, Test_BitCast_6) { auto e = NDArrayFactory::create('c', {4}, {4899988963420290048LL, 5188224837230806272LL, 5332342774136064128LL, 5476460161268730496LL}); + sd::ops::bitcast op; auto result = op.evaluate({&x}, {}, {sd::DataType::INT64}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto res = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto res = result.at(0); + // res->printIndexedBuffer("BITCAST6"); ASSERT_TRUE(e.equalsTo(res)); - delete result; + } TEST_F(DeclarableOpsTests15, Test_BitCast_7) { auto x = NDArrayFactory::create('c', {4, 4}, { @@ -531,13 +539,15 @@ TEST_F(DeclarableOpsTests15, Test_BitCast_7) { auto e = NDArrayFactory::create('c', {4}, { 4928700072476425318LL, 5202580391758873882LL, 5346698272827918477LL, 5483778673873668736LL}); + sd::ops::bitcast op; auto result = op.evaluate({&x}, {}, {sd::DataType::INT64}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto res = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto res = result.at(0); + // res->printIndexedBuffer("BITCAST7"); ASSERT_TRUE(e.equalsTo(res)); - delete result; + } TEST_F(DeclarableOpsTests15, test_matmul_bp_1) { @@ -574,13 +584,11 @@ TEST_F(DeclarableOpsTests15, test_check_numeric_1) { sd::ops::check_numerics op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(x, *z); - - delete result; } TEST_F(DeclarableOpsTests15, test_check_numeric_2) { @@ -628,8 +636,8 @@ TEST_F(DeclarableOpsTests15, Test_layer_norm_1) { sd::ops::layer_norm op; auto result = op.evaluate({&x, &g, &b}, {}, {0}, {false}); - ASSERT_EQ(Status::OK(), result->status()); - delete result; + ASSERT_EQ(Status::OK(), result.status()); + } TEST_F(DeclarableOpsTests15, Test_layer_norm_bp_1) { @@ -640,8 +648,8 @@ TEST_F(DeclarableOpsTests15, Test_layer_norm_bp_1) { sd::ops::layer_norm_bp op; auto result = op.evaluate({&x, &g, &b, &eps}, {}, {0}, {false}); - ASSERT_EQ(Status::OK(), result->status()); - delete result; + ASSERT_EQ(Status::OK(), result.status()); + } ////////////////////////////////////////////////////////////////////// @@ -678,12 +686,8 @@ TEST_F(DeclarableOpsTests15, test_hashCode_1) { // resultA0->at(0)->printIndexedBuffer("A0"); // resultA1->at(0)->printIndexedBuffer("A1"); // resultB0->at(0)->printIndexedBuffer("B0"); - ASSERT_EQ(*resultA0->at(0), *resultA1->at(0)); - ASSERT_NE(*resultA0->at(0), *resultB0->at(0)); - - delete resultA0; - delete resultA1; - delete resultB0; + ASSERT_EQ(*resultA0.at(0), *resultA1.at(0)); + ASSERT_NE(*resultA0.at(0), *resultB0.at(0)); } TEST_F(DeclarableOpsTests15, test_hashCode_2) { @@ -702,12 +706,8 @@ TEST_F(DeclarableOpsTests15, test_hashCode_2) { // resultA1->at(0)->printIndexedBuffer("A1"); // resultB0->at(0)->printIndexedBuffer("B0"); - ASSERT_EQ(*resultA0->at(0), *resultA1->at(0)); - ASSERT_NE(*resultA0->at(0), *resultB0->at(0)); - - delete resultA0; - delete resultA1; - delete resultB0; + ASSERT_EQ(*resultA0.at(0), *resultA1.at(0)); + ASSERT_NE(*resultA0.at(0), *resultB0.at(0)); } TEST_F(DeclarableOpsTests15, test_reshape_to_scalar_1) { @@ -716,13 +716,11 @@ TEST_F(DeclarableOpsTests15, test_reshape_to_scalar_1) { sd::ops::reshape op; auto result = op.evaluate({&array}, {}, {1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - - delete result; } TEST_F(DeclarableOpsTests15, test_reshape_to_scalar_2) { @@ -753,13 +751,13 @@ TEST_F(DeclarableOpsTests15, test_rank_2) { sd::ops::rank op; auto result = op.evaluate({&array}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests15, test_lstmBlock_1) { @@ -775,13 +773,11 @@ TEST_F(DeclarableOpsTests15, test_lstmBlock_1) { sd::ops::lstmBlock op; auto result = op.evaluate({&x0, &x1, &x2, &x3, &x4, &x5, &x6, &x7, &x8}, {2.0, 0.3}, {0, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Z"); - - delete result; } TEST_F(DeclarableOpsTests15, test_lstmBlock_2) { @@ -801,11 +797,10 @@ TEST_F(DeclarableOpsTests15, test_lstmBlock_2) { sd::ops::lstmBlock op; auto result = op.evaluate({&x0, &x1, &x2, &x3, &x4, &x5, &x6, &x7, &x8}, {1.0, 0.0}, {0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); - - delete result; + auto z = result.at(0); + } TEST_F(DeclarableOpsTests15, test_lstmBlock_3) { @@ -871,13 +866,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_1) { NDArray expected('c', { 1 }, std::vector{ 55 }, sd::DataType::INT32); sd::ops::rgb_to_grs op; auto result = op.evaluate({&rgbs}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -887,13 +880,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_2) { auto expected = NDArrayFactory::create('f', { 1 }, { 67 }); sd::ops::rgb_to_grs op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -903,13 +894,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_3) { NDArray expected('c', { 4, 1 }, { 41, 105, 101, 101 }, sd::DataType::INT32); sd::ops::rgb_to_grs op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -921,13 +910,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_4) { NDArray expected('c', { 2, 1 }, { 138, 58 }, sd::DataType::INT32); sd::ops::rgb_to_grs op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -937,13 +924,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_5) { NDArray expected('c', { 1, 4 }, { 50, 100, 105, 94 }, sd::DataType::INT32); sd::ops::rgb_to_grs op; auto result = op.evaluate({ &rgbs }, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -954,13 +939,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_6) { sd::ops::rgb_to_grs op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -971,13 +954,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_7) { sd::ops::rgb_to_grs op; auto result = op.evaluate({ &rgbs }, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -987,8 +968,8 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_8) { try { sd::ops::rgb_to_grs op; auto result = op.evaluate({ &rgbs }, {}, {}); - ASSERT_EQ(Status::THROW(), result->status()); - delete result; + ASSERT_EQ(Status::THROW(), result.status()); + } catch (std::exception& e) { nd4j_printf("Error should be here `%s'. It's OK.\n", e.what()); } @@ -1002,13 +983,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_grs_9) { sd::ops::rgb_to_grs op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1018,13 +997,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_yuv_1) { NDArray expected('f', { 3 }, { 55.14 , 71.2872001, -39.6005542 }, sd::DataType::FLOAT32); sd::ops::rgb_to_yuv op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1037,13 +1014,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_yuv_2) { sd::ops::rgb_to_yuv op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1054,12 +1029,10 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_yuv_3) { sd::ops::rgb_to_yuv op; auto result = op.evaluate({ &rgbs }, {}, { 0 }); - auto output = result->at(0); - ASSERT_EQ(Status::OK(), result->status()); + auto output = result.at(0); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1070,13 +1043,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_yuv_4) { sd::ops::rgb_to_yuv op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1087,12 +1058,12 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_yuv_5) { sd::ops::rgb_to_yuv op; auto result = op.evaluate({ &rgbs }, {}, { 1 }); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1102,8 +1073,8 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_yuv_6) { try { sd::ops::rgb_to_yuv op; auto result = op.evaluate({ &rgbs }, {}, {}); - ASSERT_EQ(Status::THROW(), result->status()); - delete result; + ASSERT_EQ(Status::THROW(), result.status()); + } catch (std::exception & e) { nd4j_printf("Error should be here `%s'. It's OK.\n", e.what()); @@ -1118,13 +1089,11 @@ TEST_F(DeclarableOpsTests15, test_rgb_to_yuv_7) { sd::ops::rgb_to_yuv op; auto result = op.evaluate({ &rgbs }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1134,13 +1103,13 @@ TEST_F(DeclarableOpsTests15, test_yuv_to_rgb_1) { NDArray expected('c', { 3 }, { 10, 50, 200 }, sd::DataType::FLOAT32); sd::ops::yuv_to_rgb op; auto result = op.evaluate({ &yuv }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1150,13 +1119,11 @@ TEST_F(DeclarableOpsTests15, test_yuv_to_rgb_2) { NDArray expected('f', { 3 }, { 10, 50, 200 }, sd::DataType::FLOAT32); sd::ops::yuv_to_rgb op; auto result = op.evaluate({ &yuv }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1167,12 +1134,10 @@ TEST_F(DeclarableOpsTests15, test_yuv_to_rgb_3) { sd::ops::yuv_to_rgb op; auto result = op.evaluate({ &yuv }, {}, { 0 }); - auto output = result->at(0); - ASSERT_EQ(Status::OK(), result->status()); + auto output = result.at(0); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1183,13 +1148,11 @@ TEST_F(DeclarableOpsTests15, test_yuv_to_rgb_4) { sd::ops::yuv_to_rgb op; auto result = op.evaluate({ &yuv }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1200,12 +1163,12 @@ TEST_F(DeclarableOpsTests15, test_yuv_to_rgb_5) { sd::ops::yuv_to_rgb op; auto result = op.evaluate({ &yuv }, {}, { 1 }); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1215,8 +1178,8 @@ TEST_F(DeclarableOpsTests15, test_yuv_to_rgb_6) { try { sd::ops::yuv_to_rgb op; auto result = op.evaluate({ &yuv }, {}, {}); - ASSERT_EQ(Status::THROW(), result->status()); - delete result; + ASSERT_EQ(Status::THROW(), result.status()); + } catch (std::exception & e) { nd4j_printf("Error should be here `%s'. It's OK.\n", e.what()); @@ -1231,13 +1194,11 @@ TEST_F(DeclarableOpsTests15, test_yuv_to_rgb_7) { sd::ops::yuv_to_rgb op; auto result = op.evaluate({ &yuv }, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////////////////////////// @@ -1258,17 +1219,15 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test1) { sd::ops::Pow_bp op; auto results = op.evaluate({ &x, &y, &dLdz }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* dLdx = results->at(0); - auto* dLdy = results->at(1); + auto* dLdx = results.at(0); + auto* dLdy = results.at(1); ASSERT_TRUE(dLdxExp.isSameShape(dLdx)); ASSERT_TRUE(dLdxExp.equalsTo(dLdx)); ASSERT_TRUE(dLdyExp.isSameShape(dLdy)); ASSERT_TRUE(dLdyExp.equalsTo(dLdy)); - - delete results; } TEST_F(DeclarableOpsTests15, Pow_BP_Test2) { @@ -1286,18 +1245,16 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test2) { sd::ops::Pow_bp op; auto results = op.evaluate({ &x, &y, &dLdz }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* dLdx = results->at(0); - auto* dLdy = results->at(1); + auto* dLdx = results.at(0); + auto* dLdy = results.at(1); ASSERT_TRUE(dLdxExp.isSameShape(dLdx)); ASSERT_TRUE(dLdxExp.equalsTo(dLdx)); ASSERT_TRUE(dLdyExp.isSameShape(dLdy)); ASSERT_TRUE(dLdyExp.equalsTo(dLdy)); - delete results; - } TEST_F(DeclarableOpsTests15, Pow_BP_Test3) { @@ -1317,17 +1274,15 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test3) { sd::ops::Pow_bp op; auto resultsY = op.evaluate({ &xY, &yY, &dLdz }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsY->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsY.status()); - auto* dLdxY = resultsY->at(0); - auto* dLdyY = resultsY->at(1); + auto* dLdxY = resultsY.at(0); + auto* dLdyY = resultsY.at(1); ASSERT_TRUE(dLdxExpY.isSameShape(dLdxY)); ASSERT_TRUE(dLdxExpY.equalsTo(dLdxY)); ASSERT_TRUE(dLdyExpY.isSameShape(dLdyY)); ASSERT_TRUE(dLdyExpY.equalsTo(dLdyY)); - - delete resultsY; } TEST_F(DeclarableOpsTests15, Pow_BP_Test4) { @@ -1349,17 +1304,15 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test4) { auto resultsX = op.evaluate({ &xX, &yX, &dLdz }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsX->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsX.status()); - auto* dLdxX = resultsX->at(0); - auto* dLdyX = resultsX->at(1); + auto* dLdxX = resultsX.at(0); + auto* dLdyX = resultsX.at(1); ASSERT_TRUE(dLdxExpX.isSameShape(dLdxX)); ASSERT_TRUE(dLdxExpX.equalsTo(dLdxX)); ASSERT_TRUE(dLdyExpX.isSameShape(dLdyX)); ASSERT_TRUE(dLdyExpX.equalsTo(dLdyX)); - - delete resultsX; } TEST_F(DeclarableOpsTests15, Pow_BP_Test5) { @@ -1380,18 +1333,16 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test5) { sd::ops::Pow_bp op; auto results = op.evaluate({ &xConst, &yConst, &dLdz }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* dLdx = results->at(0); - auto* dLdy = results->at(1); + auto* dLdx = results.at(0); + auto* dLdy = results.at(1); ASSERT_TRUE(dLdxExp.isSameShape(dLdx)); ASSERT_TRUE(dLdxExp.equalsTo(dLdx)); ASSERT_TRUE(dLdyExp.isSameShape(dLdy)); ASSERT_TRUE(dLdyExp.equalsTo(dLdy)); - - delete results; } TEST_F(DeclarableOpsTests15, Pow_BP_Test6) { @@ -1410,17 +1361,16 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test6) { sd::ops::Pow_bp op; auto resultsXC = op.evaluate({ &xConst, &y, &dLdzC }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsXC->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsXC.status()); - auto* dLdxXC = resultsXC->at(0); - auto* dLdyXC = resultsXC->at(1); + auto* dLdxXC = resultsXC.at(0); + auto* dLdyXC = resultsXC.at(1); ASSERT_TRUE(dLdxExpXC.isSameShape(dLdxXC)); ASSERT_TRUE(dLdxExpXC.equalsTo(dLdxXC)); ASSERT_TRUE(dLdyExpXC.isSameShape(dLdyXC)); ASSERT_TRUE(dLdyExpXC.equalsTo(dLdyXC)); - delete resultsXC; } TEST_F(DeclarableOpsTests15, Pow_BP_Test7) { @@ -1439,17 +1389,15 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test7) { sd::ops::Pow_bp op; auto resultsYs = op.evaluate({ &x, &Y, &dLdzC }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsYs->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsYs.status()); - auto* dLdxY = resultsYs->at(0); - auto* dLdyY = resultsYs->at(1); + auto* dLdxY = resultsYs.at(0); + auto* dLdyY = resultsYs.at(1); ASSERT_TRUE(dLdxExpYs.isSameShape(dLdxY)); ASSERT_TRUE(dLdxExpYs.equalsTo(dLdxY)); ASSERT_TRUE(dLdyExpYs.isSameShape(dLdyY)); ASSERT_TRUE(dLdyExpYs.equalsTo(dLdyY)); - - delete resultsYs; } TEST_F(DeclarableOpsTests15, Pow_BP_Test8) { @@ -1466,17 +1414,16 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test8) { sd::ops::Pow_bp op; auto results = op.evaluate({ &X, &Y, &dLdz }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* dLdx = results->at(0); - auto* dLdy = results->at(1); + auto* dLdx = results.at(0); + auto* dLdy = results.at(1); ASSERT_TRUE(dLdxExp.isSameShape(dLdx)); ASSERT_TRUE(dLdxExp.equalsTo(dLdx)); ASSERT_TRUE(dLdyExp.isSameShape(dLdy)); ASSERT_TRUE(dLdyExp.equalsTo(dLdy)); - - delete results; + } TEST_F(DeclarableOpsTests15, Pow_BP_Test9) { @@ -1495,17 +1442,15 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test9) { dLdz.linspace(0.1, 0.1); auto results = op.evaluate({ &x, &y, &dLdz }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* dLdx = results->at(0); - auto* dLdy = results->at(1); + auto* dLdx = results.at(0); + auto* dLdy = results.at(1); ASSERT_TRUE(dLdxExp.isSameShape(dLdx)); ASSERT_TRUE(dLdxExp.equalsTo(dLdx)); ASSERT_TRUE(dLdyExp.isSameShape(dLdy)); ASSERT_TRUE(dLdyExp.equalsTo(dLdy)); - - delete results; } TEST_F(DeclarableOpsTests15, Pow_BP_Test10) { @@ -1525,18 +1470,16 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test10) { sd::ops::Pow_bp op; auto resultsB = op.evaluate({ &xB, &yB, &dLdzB }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsB->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsB.status()); - auto* dLdxB = resultsB->at(0); - auto* dLdyB = resultsB->at(1); + auto* dLdxB = resultsB.at(0); + auto* dLdyB = resultsB.at(1); ASSERT_TRUE(dLdxExpB.isSameShape(dLdxB)); ASSERT_TRUE(dLdxExpB.equalsTo(dLdxB)); ASSERT_TRUE(dLdyExpB.isSameShape(dLdyB)); ASSERT_TRUE(dLdyExpB.equalsTo(dLdyB)); - - delete resultsB; } TEST_F(DeclarableOpsTests15, Pow_BP_Test11) { @@ -1556,9 +1499,9 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test11) { sd::ops::Pow_bp op; auto resultsB = op.evaluate({ &xB, &yB, &dLdzB }, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsB->status()); - auto* dLdxB = resultsB->at(0); - auto* dLdyB = resultsB->at(1); + ASSERT_EQ(ND4J_STATUS_OK, resultsB.status()); + auto* dLdxB = resultsB.at(0); + auto* dLdyB = resultsB.at(1); ASSERT_TRUE(dLdxExpB.isSameShape(dLdxB)); for (int i = 0; i < dLdxB->lengthOf(); ++i) { @@ -1572,7 +1515,7 @@ TEST_F(DeclarableOpsTests15, Pow_BP_Test11) { ASSERT_NEAR(dLdyB->e(i), dLdyExpB.e(i), 0.00001); } - delete resultsB; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP1) { @@ -1588,10 +1531,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP1) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 2,0,1, 2,0,1 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dLdA.isSameShape(*dLdAbp)); ASSERT_TRUE(dLdA.equalsTo(*dLdAbp)); @@ -1599,7 +1542,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP1) { ASSERT_TRUE(dLdB.isSameShape(*dLdBbp)); ASSERT_TRUE(dLdB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP2) { @@ -1611,10 +1553,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP2) { sd::ops::tensormmul_bp op_bp; auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 2,1,2, 2,1,2 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(B.isSameShape(*dLdAbp)); ASSERT_TRUE(B.equalsTo(*dLdAbp)); @@ -1622,7 +1564,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP2) { ASSERT_TRUE(A.isSameShape(*dLdBbp)); ASSERT_TRUE(A.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP3) { @@ -1638,10 +1579,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP3) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 2,1,2, 2,1,2 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dA.isSameShape(*dLdAbp)); ASSERT_TRUE(dA.equalsTo(*dLdAbp)); @@ -1649,7 +1590,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP3) { ASSERT_TRUE(dB.isSameShape(*dLdBbp)); ASSERT_TRUE(dB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP4) { @@ -1665,10 +1605,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP4) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 2,1,2, 2,1,2 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dLdA.isSameShape(*dLdAbp)); ASSERT_TRUE(dLdA.equalsTo(*dLdAbp)); @@ -1676,7 +1616,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP4) { ASSERT_TRUE(dLdB.isSameShape(*dLdBbp)); ASSERT_TRUE(dLdB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP5) { @@ -1692,10 +1631,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP5) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 2,1,2, 2,1,2 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dLdA.isSameShape(*dLdAbp)); ASSERT_TRUE(dLdA.equalsTo(*dLdAbp)); @@ -1703,7 +1642,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP5) { ASSERT_TRUE(dLdB.isSameShape(*dLdBbp)); ASSERT_TRUE(dLdB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP6) { @@ -1716,10 +1654,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP6) { sd::ops::tensormmul_bp op_bp; auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 3,0,1,2, 3,0,1,2 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(B.isSameShape(*dLdAbp)); ASSERT_TRUE(B.equalsTo(*dLdAbp)); @@ -1727,7 +1665,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP6) { ASSERT_TRUE(A.isSameShape(*dLdBbp)); ASSERT_TRUE(A.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP7) { @@ -1743,9 +1680,9 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP7) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 1,1, 1,1 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dLdA.isSameShape(*dLdAbp)); ASSERT_TRUE(dLdA.equalsTo(*dLdAbp)); @@ -1753,7 +1690,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP7) { ASSERT_TRUE(dLdB.isSameShape(*dLdBbp)); ASSERT_TRUE(dLdB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP8) { @@ -1769,10 +1705,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP8) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 3,0,1,2, 3,0,1,2 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dLdA.isSameShape(*dLdAbp)); ASSERT_TRUE(dLdA.equalsTo(*dLdAbp)); @@ -1780,7 +1716,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP8) { ASSERT_TRUE(dLdB.isSameShape(*dLdBbp)); ASSERT_TRUE(dLdB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP9) { @@ -1796,10 +1731,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP9) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 2,1,2, 2,1,2 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dA.isSameShape(*dLdAbp)); ASSERT_TRUE(dA.equalsTo(*dLdAbp)); @@ -1807,7 +1742,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP9) { ASSERT_TRUE(dB.isSameShape(*dLdBbp)); ASSERT_TRUE(dB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP10) { @@ -1824,10 +1758,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP10) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 2,1,2, 2,1,2 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dA.isSameShape(*dLdAbp)); ASSERT_TRUE(dA.equalsTo(*dLdAbp)); @@ -1835,7 +1769,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP10) { ASSERT_TRUE(dB.isSameShape(*dLdBbp)); ASSERT_TRUE(dB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP11) { @@ -1852,10 +1785,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP11) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 2,0,1, 2,0,1 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dA.isSameShape(*dLdAbp)); ASSERT_TRUE(dA.equalsTo(*dLdAbp)); @@ -1863,7 +1796,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP11) { ASSERT_TRUE(dB.isSameShape(*dLdBbp)); ASSERT_TRUE(dB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP12) { @@ -1881,10 +1813,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP12) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 1,1, 1,1 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dA.isSameShape(*dLdAbp)); ASSERT_TRUE(dA.equalsTo(*dLdAbp)); @@ -1892,7 +1824,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP12) { ASSERT_TRUE(dB.isSameShape(*dLdBbp)); ASSERT_TRUE(dB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP13) { @@ -1910,10 +1841,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP13) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 1,1, 1,1 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dA.isSameShape(*dLdAbp)); ASSERT_TRUE(dA.equalsTo(*dLdAbp)); @@ -1921,7 +1852,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP13) { ASSERT_TRUE(dB.isSameShape(*dLdBbp)); ASSERT_TRUE(dB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP14) { @@ -1943,10 +1873,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP14) { auto resultsBP = op_bp.evaluate({ &A, &B, &dLdC }, {}, { 1,1, 1,1 }, {}); - ASSERT_EQ(ND4J_STATUS_OK, resultsBP->status()); + ASSERT_EQ(ND4J_STATUS_OK, resultsBP.status()); - auto* dLdAbp = resultsBP->at(0); - auto* dLdBbp = resultsBP->at(1); + auto* dLdAbp = resultsBP.at(0); + auto* dLdBbp = resultsBP.at(1); ASSERT_TRUE(dA.isSameShape(*dLdAbp)); ASSERT_TRUE(dA.equalsTo(*dLdAbp)); @@ -1954,7 +1884,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP14) { ASSERT_TRUE(dB.isSameShape(*dLdBbp)); ASSERT_TRUE(dB.equalsTo(*dLdBbp)); - delete resultsBP; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP15) { @@ -1970,10 +1899,10 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP15) { sd::ops::tensormmul_bp op; auto results = op.evaluate({ &A, &B, &dLdC }, {}, { 2,1,2,2,1,2 }); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto* dLdA = results->at(0); - auto* dLdB = results->at(1); + auto* dLdA = results.at(0); + auto* dLdB = results.at(1); ASSERT_TRUE(dA.isSameShape(*dLdA)); ASSERT_TRUE(dA.equalsTo(*dLdA)); @@ -1981,7 +1910,6 @@ TEST_F(DeclarableOpsTests15, TestTensorMmul_BP15) { ASSERT_TRUE(dB.isSameShape(*dLdB)); ASSERT_TRUE(dB.equalsTo(*dLdB)); - delete results; } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests15, TestTensorMmul_BP16) { diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests16.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests16.cpp index 800c9cbf8..c909b7686 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests16.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests16.cpp @@ -47,13 +47,11 @@ TEST_F(DeclarableOpsTests16, scatter_upd_1) { sd::ops::scatter_upd op; auto result = op.evaluate({ &x, &y, &w }); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - - delete result; } TEST_F(DeclarableOpsTests16, scatter_upd_2) { @@ -67,13 +65,11 @@ TEST_F(DeclarableOpsTests16, scatter_upd_2) { sd::ops::scatter_upd op; auto result = op.evaluate({ &x, &indices, &updates }); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - - delete result; } TEST_F(DeclarableOpsTests16, scatter_upd_3) { @@ -136,13 +132,11 @@ TEST_F(DeclarableOpsTests16, test_hamming_distance_1) { sd::ops::bits_hamming_distance op; auto result = op.evaluate({ &x, &y }); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - - delete result; } TEST_F(DeclarableOpsTests16, test_knn_mindistance_1) { @@ -167,10 +161,8 @@ TEST_F(DeclarableOpsTests16, test_empty_cast_1) { sd::ops::cast op; auto result = op.evaluate({&x}, {10}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_EQ(e, *result->at(0)); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_EQ(e, *result.at(0)); } TEST_F(DeclarableOpsTests16, test_range_1) { @@ -717,8 +709,6 @@ TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_1) { } - - TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_2) { auto rgb = NDArrayFactory::create('c', { 5, 3, 4 }, @@ -767,7 +757,6 @@ TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_2) { } - TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_3) { auto rgb = NDArrayFactory::create('c', { 4, 3 }, @@ -798,7 +787,6 @@ TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_3) { } - TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_4) { auto rgb = NDArrayFactory::create('c', { 3, 4 }, @@ -826,7 +814,6 @@ TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_4) { ASSERT_EQ(ND4J_STATUS_OK, status); ASSERT_TRUE(expected.equalsTo(actual)); - } @@ -850,7 +837,6 @@ TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_5) { ASSERT_EQ(ND4J_STATUS_OK, status); ASSERT_TRUE(expected.equalsTo(actual)); - } TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_6) { @@ -891,8 +877,6 @@ TEST_F(DeclarableOpsTests16, test_rgb_to_yiq_6) { } - - TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_1) { auto yiqs = NDArrayFactory::create('c', { 5, 4, 3 }, { @@ -937,8 +921,6 @@ TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_1) { } - - TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_2) { auto yiqs = NDArrayFactory::create('c', { 5, 3, 4 }, { @@ -983,7 +965,6 @@ TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_2) { } - TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_3) { auto yiqs = NDArrayFactory::create('c', { 4, 3 }, { @@ -1010,7 +991,6 @@ TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_3) { } - TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_4) { auto yiqs = NDArrayFactory::create('c', { 3, 4 }, { @@ -1037,8 +1017,6 @@ TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_4) { } - - TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_5) { auto yiqs = NDArrayFactory::create('c', { 3 }, { @@ -1061,7 +1039,6 @@ TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_5) { #endif ASSERT_EQ(ND4J_STATUS_OK, status); ASSERT_TRUE(expected.equalsTo(actual)); - } TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_6) { @@ -1096,5 +1073,4 @@ TEST_F(DeclarableOpsTests16, test_yiq_to_rgb_6) { ASSERT_EQ(ND4J_STATUS_OK, status); ASSERT_TRUE(expected.equalsTo(actual)); - } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests17.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests17.cpp index d0fda960c..1341312f8 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests17.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests17.cpp @@ -49,9 +49,7 @@ TEST_F(DeclarableOpsTests17, test_sparse_to_dense_1) { sd::ops::compat_sparse_to_dense op; auto result = op.evaluate({&ranges, &shape, &values, &def}); - ASSERT_EQ(Status::OK(), result->status()); - - delete result; + ASSERT_EQ(Status::OK(), result.status()); } TEST_F(DeclarableOpsTests17, test_sparse_to_dense_2) { @@ -64,9 +62,8 @@ TEST_F(DeclarableOpsTests17, test_sparse_to_dense_2) { sd::ops::compat_sparse_to_dense op; auto result = op.evaluate({&ranges, &shape, &values, &def}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; } TEST_F(DeclarableOpsTests17, test_compat_string_split_1) { @@ -78,11 +75,11 @@ TEST_F(DeclarableOpsTests17, test_compat_string_split_1) { sd::ops::compat_string_split op; auto result = op.evaluate({&x, &delimiter}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_EQ(2, result.size()); - auto z0 = result->at(0); - auto z1 = result->at(1); + auto z0 = result.at(0); + auto z1 = result.at(1); ASSERT_TRUE(exp0.isSameShape(z0)); ASSERT_TRUE(exp1.isSameShape(z1)); @@ -90,5 +87,4 @@ TEST_F(DeclarableOpsTests17, test_compat_string_split_1) { ASSERT_EQ(exp0, *z0); ASSERT_EQ(exp1, *z1); - delete result; } \ No newline at end of file diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests19.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests19.cpp index 09bc17cde..8b2bd0071 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests19.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests19.cpp @@ -62,10 +62,8 @@ TEST_F(DeclarableOpsTests19, test_conv1d_bp_1) { sd::ops::conv1d_bp op; auto result = op.evaluate({&t, &u, &v}, {3, 2, 0, 1, 2,0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - - delete result; } TEST_F(DeclarableOpsTests19, test_squeeze_1) { diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests2.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests2.cpp index 58e9bf450..f4847889b 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests2.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests2.cpp @@ -43,17 +43,14 @@ TEST_F(DeclarableOpsTests2, gather_1) { auto result = op.evaluate({&input, &indices}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto* output = result->at(0); + auto* output = result.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } - TEST_F(DeclarableOpsTests2, gather_2) { NDArray input('c', {2,3,4}, {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}); @@ -64,14 +61,12 @@ TEST_F(DeclarableOpsTests2, gather_2) { auto result = op.evaluate({&input}, {}, {1, 0,1, 2,2, 1,2}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto* output = result->at(0); + auto* output = result.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } @@ -86,14 +81,12 @@ TEST_F(DeclarableOpsTests2, gather_3) { auto result = op.evaluate({&input, &indices}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto* output = result->at(0); + auto* output = result.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } TEST_F(DeclarableOpsTests2, gather_4) { @@ -106,14 +99,12 @@ TEST_F(DeclarableOpsTests2, gather_4) { auto result = op.evaluate({&input}, {}, {1, 2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto* output = result->at(0); + auto* output = result.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; } //////////////////////////////////////////////////////////////////// @@ -127,17 +118,16 @@ TEST_F(DeclarableOpsTests2, gather_5) { auto result = op.evaluate({&input, &indices}, {}, {1}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto* output = result->at(0); + auto* output = result.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } - //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests2, gather_6) { @@ -149,17 +139,15 @@ TEST_F(DeclarableOpsTests2, gather_6) { auto result = op.evaluate({&input, &indices}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto* output = result->at(0); + auto* output = result.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; } - //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests2, gather_7) { @@ -171,17 +159,15 @@ TEST_F(DeclarableOpsTests2, gather_7) { auto result = op.evaluate({&input, &indices}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto* output = result->at(0); + auto* output = result.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; + } - //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests2, gather_8) { @@ -192,15 +178,14 @@ TEST_F(DeclarableOpsTests2, gather_8) { sd::ops::gather op; auto result = op.evaluate({&input, &indices}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto* output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto* output = result.at(0); // output->printShapeInfo(); // output->printIndexedBuffer(); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; } //////////////////////////////////////////////////////////////////// @@ -210,11 +195,9 @@ TEST_F(DeclarableOpsTests2, gather_9) { sd::ops::gather op; auto result = op.evaluate({&x, &indices}, {}, {-2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); - - delete result; + auto z = result.at(0); } //////////////////////////////////////////////////////////////////// @@ -224,14 +207,13 @@ TEST_F(DeclarableOpsTests2, gather_10) { sd::ops::gather op; auto result = op.evaluate({&x}, {}, {0, 1, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - delete result; } //////////////////////////////////////////////////////////////////// @@ -243,14 +225,13 @@ TEST_F(DeclarableOpsTests2, gather_11) { sd::ops::gather op; auto result = op.evaluate({&x, &indices}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////// @@ -262,14 +243,13 @@ TEST_F(DeclarableOpsTests2, gather_12) { sd::ops::gather op; auto result = op.evaluate({&input, &indices}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////// @@ -296,14 +276,13 @@ TEST_F(DeclarableOpsTests2, gather_13) { auto result = op.evaluate({&input, &indices}, {}, {2}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto* output = result->at(0); + auto* output = result.at(0); ASSERT_TRUE(expected.isSameShapeStrict(*output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete result; + } //////////////////////////////////////////////////////////////////// @@ -339,9 +318,8 @@ TEST_F(DeclarableOpsTests2, BroadcastGradientArgs_1) { auto result = op.evaluate({&input, &indices}, {}, {}); - ASSERT_EQ(ND4J_STATUS_KERNEL_FAILURE, result->status()); - - delete result; + ASSERT_EQ(ND4J_STATUS_KERNEL_FAILURE, result.status()); + } TEST_F(DeclarableOpsTests2, NLP_Cbow_Test_1) { @@ -376,7 +354,7 @@ TEST_F(DeclarableOpsTests2, NLP_Cbow_Test_1) { sd::ops::cbow op; auto result = op.evaluate({&target, &ngStarter, &context, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &numWords, &locked, &inferenceVector}, {}, {}, {true}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); auto row_s0_0 = syn0({0,1, 0,0}, true); auto row_s0_1 = syn0({1,2, 0,0}, true); @@ -393,8 +371,7 @@ TEST_F(DeclarableOpsTests2, NLP_Cbow_Test_1) { ASSERT_EQ(exp1, row_s1_4); ASSERT_EQ(exp1, row_s1_5); ASSERT_EQ(exp2, row_s1_6); - - delete result; + } TEST_F(DeclarableOpsTests2, Test_Squeeze_1) { @@ -405,14 +382,13 @@ TEST_F(DeclarableOpsTests2, Test_Squeeze_1) { sd::ops::squeeze op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } @@ -424,14 +400,13 @@ TEST_F(DeclarableOpsTests2, Test_Squeeze_2) { sd::ops::squeeze op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp->isSameShape(z)); ASSERT_TRUE(exp->equalsTo(z)); - - delete result; + delete exp; } @@ -444,13 +419,12 @@ TEST_F(DeclarableOpsTests2, Test_FloorMod_1) { auto result = op.evaluate({&x, &y}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(DeclarableOpsTests2, Test_FloorDiv_1) { @@ -462,14 +436,10 @@ TEST_F(DeclarableOpsTests2, Test_FloorDiv_1) { auto result = op.evaluate({&x, &y}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("FloorDiv1 shape"); // z->printIndexedBuffer("FloorDiv1"); ASSERT_TRUE(exp.isSameShape(z)); - - ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } TEST_F(DeclarableOpsTests2, Test_FloorDiv_2) { @@ -483,9 +453,9 @@ TEST_F(DeclarableOpsTests2, Test_FloorDiv_2) { sd::ops::floordiv_bp op; auto result = op.evaluate({&x, &y, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - auto z1 = result->at(0); - auto z2 = result->at(1); + ASSERT_EQ(result.status(), Status::OK()); + auto z1 = result.at(0); + auto z2 = result.at(1); // z->printShapeInfo("FloorDiv1 shape"); // z1->printIndexedBuffer("FloorDiv2_1"); // z2->printIndexedBuffer("FloorDiv2_2"); @@ -493,7 +463,6 @@ TEST_F(DeclarableOpsTests2, Test_FloorDiv_2) { ASSERT_TRUE(exp1.equalsTo(z1)); ASSERT_TRUE(exp2.equalsTo(z2)); - delete result; } TEST_F(DeclarableOpsTests2, Test_CRelu_1) { @@ -504,14 +473,13 @@ TEST_F(DeclarableOpsTests2, Test_CRelu_1) { auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(DeclarableOpsTests2, Test_CRelu_BP_2) { @@ -521,15 +489,14 @@ TEST_F(DeclarableOpsTests2, Test_CRelu_BP_2) { sd::ops::crelu_bp op; auto result = op.evaluate({&x, &eps}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(DeclarableOpsTests2, Test_Concat_BP_1) { @@ -541,23 +508,19 @@ TEST_F(DeclarableOpsTests2, Test_Concat_BP_1) { sd::ops::concat_bp op; auto result = op.evaluate({&x, &y, &eps}, {}, {-1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto epsX = result->at(0); - auto epsY = result->at(1); + auto epsX = result.at(0); + auto epsY = result.at(1); ASSERT_TRUE(expEX.isSameShape(epsX)); ASSERT_TRUE(expEX.equalsTo(epsX)); ASSERT_TRUE(expEY.isSameShape(epsY)); ASSERT_TRUE(expEY.equalsTo(epsY)); - - delete result; } - - //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_1) { @@ -574,18 +537,15 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_1) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; - } - //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_2) { @@ -602,16 +562,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_2) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printIndexedBuffer("ADL test2"); // expected.printIndexedBuffer("ADL expec"); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; - } //////////////////////////////////////////////////////////////////// @@ -630,15 +588,13 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_3) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; - } //////////////////////////////////////////////////////////////////// @@ -657,15 +613,13 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_4) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; - } //////////////////////////////////////////////////////////////////// @@ -684,15 +638,13 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_5) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; - } //////////////////////////////////////////////////////////////////// @@ -711,15 +663,13 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_6) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; - } //////////////////////////////////////////////////////////////////// @@ -736,15 +686,13 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_7) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 60.f); - delete results; - } //////////////////////////////////////////////////////////////////// @@ -761,14 +709,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_8) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 0.f); - delete results; + } @@ -786,14 +734,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_9) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 60.); - delete results; + } @@ -811,14 +759,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_10) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 60.f); - delete results; + } @@ -836,14 +784,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_11) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 1.f); - delete results; + } @@ -861,14 +809,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_12) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 0.f); - delete results; + } @@ -886,14 +834,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_13) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 1.f); - delete results; + } @@ -913,14 +861,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_14) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 1.f); - delete results; + } @@ -938,14 +886,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_15) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 2.f); - delete results; + } @@ -967,14 +915,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_16) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 2.01667, 1e-5); - delete results; + } @@ -1000,14 +948,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_17) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 1.93333, 1e-5); - delete results; + } @@ -1033,14 +981,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_18) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 1.93333f, 1e-5); - delete results; + } @@ -1059,14 +1007,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_19) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 1.); - delete results; + } @@ -1084,14 +1032,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_20) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 1.); - delete results; + } @@ -1109,14 +1057,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_21) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 1.f); - delete results; + } @@ -1134,14 +1082,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_22) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 0.); - delete results; + } @@ -1171,14 +1119,14 @@ TEST_F(DeclarableOpsTests2, absolute_difference_loss_test_23) { sd::ops::absolute_difference_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.965517, 1e-5); - delete results; + } @@ -1197,14 +1145,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test1) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0,0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -1223,14 +1171,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test2) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -1250,14 +1198,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test3) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0,2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1275,14 +1223,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test4) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0,2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -1300,14 +1248,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test5) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == -71.); - delete results; + } @@ -1325,14 +1273,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test6) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1,1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == -71.f); - delete results; + } @@ -1350,14 +1298,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test7) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1,0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == -69.f); - delete results; + } @@ -1375,14 +1323,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test8) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2,2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == -24.f); - delete results; + } @@ -1400,14 +1348,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test9) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2,2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == -24.); - delete results; + } @@ -1427,14 +1375,14 @@ TEST_F(DeclarableOpsTests2, cosine_distance_loss_test10) { sd::ops::cosine_distance_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2,2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == -32.); - delete results; + } @@ -1452,15 +1400,15 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test1) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printBuffer(); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1477,15 +1425,15 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test2) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printBuffer(); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1502,15 +1450,15 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test3) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); // result->printBuffer(); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1527,14 +1475,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test4) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 83.); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1551,14 +1499,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test5) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 83.); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1575,14 +1523,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test6) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 83.); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1599,14 +1547,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test7) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 6.91667, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1623,14 +1571,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test8) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 6.91667, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1647,14 +1595,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test9) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 6.91667, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1671,14 +1619,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test10) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 3.45833, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1695,14 +1643,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test11) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 3.45833, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1723,14 +1671,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test12) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 3.975, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1747,14 +1695,14 @@ TEST_F(DeclarableOpsTests2, hinge_loss_test13) { sd::ops::hinge_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_TRUE(result->e(0) == 0.); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1772,14 +1720,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test1) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1797,14 +1745,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test2) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1822,14 +1770,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test3) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1846,14 +1794,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test4) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 13.44, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1870,14 +1818,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test5) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 13.44, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1894,14 +1842,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test6) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 1.12, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1918,14 +1866,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test7) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 1.12, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1946,14 +1894,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test8) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 1.3, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1970,14 +1918,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test9) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.56, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1994,14 +1942,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test10) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.56, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2022,14 +1970,14 @@ TEST_F(DeclarableOpsTests2, huber_loss_test11) { sd::ops::huber_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {0.1}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.65, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2047,14 +1995,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test1) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2072,14 +2020,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test2) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2097,14 +2045,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test3) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2121,14 +2069,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test4) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -113.886429, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2145,14 +2093,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test5) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -113.886429, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2169,14 +2117,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test6) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -113.886429, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2193,14 +2141,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test7) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -9.490536, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2217,14 +2165,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test8) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -9.490536, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2241,14 +2189,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test9) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -9.490536, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2269,14 +2217,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test10) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -12.443609, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2293,14 +2241,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test11) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -4.745268, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2317,14 +2265,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test12) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -4.745268, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2345,14 +2293,14 @@ TEST_F(DeclarableOpsTests2, log_loss_test13) { sd::ops::log_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {1e-7}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -6.221805, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2365,14 +2313,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test1) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2385,14 +2333,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test2) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2405,14 +2353,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test3) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2424,14 +2372,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test4) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 60.74394998193965, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2443,14 +2391,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test5) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 15.189082270182983, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2462,14 +2410,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test6) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 13.568564090650312, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2481,14 +2429,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test7) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 198.318201904499, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2500,14 +2448,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test8) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 10.709003499121707, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2519,14 +2467,14 @@ TEST_F(DeclarableOpsTests2, mean_pairwssqerr_loss_test9) { sd::ops::mean_pairwssqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 17.686067864414472, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test1) { @@ -2543,14 +2491,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test1) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2568,14 +2516,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test2) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2593,14 +2541,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test3) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2622,14 +2570,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test4) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2646,14 +2594,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test5) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 612.5, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2670,14 +2618,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test6) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 612.5, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2694,14 +2642,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test7) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 612.5, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2722,14 +2670,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test8) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 608.75, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2746,14 +2694,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test9) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 51.041668, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2770,14 +2718,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test10) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 51.041668, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2794,14 +2742,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test11) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 51.041668, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2821,14 +2769,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test12) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 88.541664, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2845,14 +2793,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test13) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 25.520834, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2869,14 +2817,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test14) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 25.520834, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2893,14 +2841,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test15) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 25.520834, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2920,14 +2868,14 @@ TEST_F(DeclarableOpsTests2, mean_sqerr_loss_test16) { sd::ops::mean_sqerr_loss op; auto results = op.evaluate({&predictions, &weights, &labels}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 44.270832, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2944,14 +2892,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test1) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2968,14 +2916,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test2) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2992,14 +2940,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test3) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3016,14 +2964,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test4) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3039,14 +2987,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test5) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 11.2187976837, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3062,14 +3010,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test6) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 11.2187976837, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3085,14 +3033,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test7) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 11.2187976837, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3108,14 +3056,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test8) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 10.2187976837, 1e-5); - delete results; + } @@ -3135,14 +3083,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test9) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 6.06840181351, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3158,14 +3106,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test10) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.934899806976, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3181,14 +3129,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test11) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.934899806976, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3204,14 +3152,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test12) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.851566493511, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3230,14 +3178,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test13) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 1.01140034199, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3253,14 +3201,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test14) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.467449903488, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3276,14 +3224,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test15) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.467449903488, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3299,14 +3247,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test16) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.425783246756, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3325,14 +3273,14 @@ TEST_F(DeclarableOpsTests2, sigm_cross_entropy_loss_test17) { sd::ops::sigm_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 0.505700170994, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3349,13 +3297,13 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test1) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3372,14 +3320,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test2) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {0}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3396,14 +3344,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test3) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3420,14 +3368,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test4) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3444,14 +3392,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test5) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3467,14 +3415,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test6) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), 8.55521392822, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3490,14 +3438,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test7) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -6.37014198303, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3513,14 +3461,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test8) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -6.37014198303, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3536,14 +3484,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test9) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -6.37014198303, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3559,14 +3507,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test10) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -2.12338066101, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3582,14 +3530,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test11) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {3}, {}, {}, false); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -1.06169033051, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3605,14 +3553,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test12) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {3}, {}, {}, false); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(result->isScalar()); ASSERT_NEAR(result->e(0), -2.18880319595, 1e-5); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3629,14 +3577,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test13) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {0.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } @@ -3655,14 +3603,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test14) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3679,14 +3627,14 @@ TEST_F(DeclarableOpsTests2, softmax_cross_entropy_loss_test15) { sd::ops::softmax_cross_entropy_loss op; auto results = op.evaluate({&logits, &weights, &labels}, {5.}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *result = results->at(0); + auto *result = results.at(0); ASSERT_TRUE(expected.isSameShape(result)); ASSERT_TRUE(expected.equalsTo(result)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3721,17 +3669,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test1) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0., 0., 1.}, {0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3766,17 +3714,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test2) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0., 0., -10.5}, {0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3811,17 +3759,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test3) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0.4, 0., 1.5}, {0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3856,17 +3804,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test4) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0.4, 0.3, 1.5}, {0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3901,17 +3849,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test5) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0.4, 0.3, 1.5}, {0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3946,17 +3894,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test6) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0., 0., 1.5}, {0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -3991,17 +3939,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test7) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0.4, 0., 1.5}, {0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } @@ -4037,17 +3985,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test8) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0., 0., 10.5}, {1, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht,1e-4)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct,1e-4)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -4082,17 +4030,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test9) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {3., 0., 10.5}, {1, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht,1e-4)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -4127,17 +4075,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test10) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {0., 0., 10.5}, {1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -4172,17 +4120,17 @@ TEST_F(DeclarableOpsTests2, lstmCell_test11) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {3., 0., 10.5}, {1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -4217,15 +4165,15 @@ TEST_F(DeclarableOpsTests2, lstmCell_test12) { sd::ops::lstmCell op; auto results = op.evaluate({&xt, &ht_1, &ct_1, &Wx, &Wh, &Wc, &Wp, &b}, {3., 1.,-5.}, {1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests3.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests3.cpp index c9e86df72..eddef73b3 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests3.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests3.cpp @@ -44,13 +44,13 @@ TEST_F(DeclarableOpsTests3, Test_Tile_1) { sd::ops::tile op; auto result = op.evaluate({&x, &rep_vector}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -62,13 +62,13 @@ TEST_F(DeclarableOpsTests3, Test_Tile_2) { sd::ops::tile op; auto result = op.evaluate({&x}, {}, {2, 2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests3, Test_Permute_1) { @@ -78,13 +78,11 @@ TEST_F(DeclarableOpsTests3, Test_Permute_1) { sd::ops::permute op; auto result = op.evaluate({&x, &permute}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - - delete result; } TEST_F(DeclarableOpsTests3, Test_Permute_2) { @@ -93,13 +91,12 @@ TEST_F(DeclarableOpsTests3, Test_Permute_2) { sd::ops::permute op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - delete result; } @@ -112,11 +109,11 @@ TEST_F(DeclarableOpsTests3, Test_Unique_1) { sd::ops::unique op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto i = result->at(1); + auto v = result.at(0); + auto i = result.at(1); // v->printIndexedBuffer("Values"); // i->printIndexedBuffer("Indices"); // i->printShapeInfo("Indices shape"); @@ -126,7 +123,7 @@ TEST_F(DeclarableOpsTests3, Test_Unique_1) { ASSERT_TRUE(expI.isSameShape(i)); ASSERT_TRUE(expI.equalsTo(i)); - delete result; + } TEST_F(DeclarableOpsTests3, Test_Unique_2) { @@ -138,12 +135,12 @@ TEST_F(DeclarableOpsTests3, Test_Unique_2) { sd::ops::unique_with_counts op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(3, result.size()); - auto v = result->at(0); - auto i = result->at(1); - auto c = result->at(2); + auto v = result.at(0); + auto i = result.at(1); + auto c = result.at(2); // v->printShapeInfo(); // v->printIndexedBuffer("Values"); @@ -160,8 +157,6 @@ TEST_F(DeclarableOpsTests3, Test_Unique_2) { ASSERT_TRUE(expC.isSameShape(c)); ASSERT_TRUE(expC.equalsTo(c)); - - delete result; } TEST_F(DeclarableOpsTests3, Test_Rint_1) { @@ -170,13 +165,13 @@ TEST_F(DeclarableOpsTests3, Test_Rint_1) { sd::ops::rint op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -190,16 +185,14 @@ TEST_F(DeclarableOpsTests3, Test_Norm_1) { auto result0 = op.evaluate({&x}, {0.}, {}); - auto z0 = result0->at(0); + auto z0 = result0.at(0); auto exp0 = x.reduceAlongDimension(reduce::NormFrobenius, empty, false, false); ASSERT_TRUE(exp0.isSameShape(z0)); ASSERT_TRUE(exp0.equalsTo(z0)); - delete result0; - auto result1 = op.evaluate({&x}, {1.}, {1}); - ASSERT_EQ(result1->status(), ND4J_STATUS_OK); - auto z1 = result1->at(0); + ASSERT_EQ(result1.status(), ND4J_STATUS_OK); + auto z1 = result1.at(0); // z1->printIndexedBuffer("Z1"); auto exp1 = x.reduceAlongDimension(reduce::Norm2, dims, false, false); // exp1.printIndexedBuffer("EXP1"); @@ -208,16 +201,12 @@ TEST_F(DeclarableOpsTests3, Test_Norm_1) { ASSERT_TRUE(exp1.isSameShape(z1)); ASSERT_TRUE(exp1.equalsTo(z1)); - delete result1; - auto result4 = op.evaluate({&x}, {4.}, {1}); - auto z4 = result4->at(0); + auto z4 = result4.at(0); auto exp4= x.reduceAlongDimension(reduce::NormMax, dims, false, false); ASSERT_TRUE(exp4.isSameShape(z4)); ASSERT_TRUE(exp4.equalsTo(z4)); - - delete result4; } @@ -232,30 +221,27 @@ TEST_F(DeclarableOpsTests3, Test_Norm_2) { auto result0 = op.evaluate({&x}, {0}, {}); - auto z0 = result0->at(0); + auto z0 = result0.at(0); auto exp0 = x.reduceAlongDimension(reduce::NormFrobenius, empty, false, false); ASSERT_TRUE(exp0.isSameShape(z0)); ASSERT_TRUE(exp0.equalsTo(z0)); - delete result0; + auto result1 = op.evaluate({&x, &axis}, {1}, {}); - auto z1 = result1->at(0); + auto z1 = result1.at(0); auto exp1 = x.reduceAlongDimension(reduce::Norm2, dims, false, false); ASSERT_TRUE(exp1.isSameShape(z1)); ASSERT_TRUE(exp1.equalsTo(z1)); - delete result1; - auto result4 = op.evaluate({&x, &axis}, {4}, {}); - auto z4 = result4->at(0); + auto z4 = result4.at(0); auto exp4= x.reduceAlongDimension(reduce::NormMax, dims, false, false); ASSERT_TRUE(exp4.isSameShape(z4)); ASSERT_TRUE(exp4.equalsTo(z4)); - delete result4; } @@ -266,12 +252,10 @@ TEST_F(DeclarableOpsTests3, Test_ClipByAvgNorm_1) { sd::ops::clipbyavgnorm op; auto result = op.evaluate({&x}, {0.8}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; } TEST_F(DeclarableOpsTests3, Test_ClipByAvgNorm_2) { @@ -281,12 +265,11 @@ TEST_F(DeclarableOpsTests3, Test_ClipByAvgNorm_2) { sd::ops::clipbyavgnorm op; auto result = op.evaluate({&x}, {0.9}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -297,12 +280,11 @@ TEST_F(DeclarableOpsTests3, Test_ClipByNorm_1) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {4.0}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(DeclarableOpsTests3, Test_ClipByNorm_2) { @@ -312,12 +294,11 @@ TEST_F(DeclarableOpsTests3, Test_ClipByNorm_2) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {6.0}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -341,7 +322,7 @@ TEST_F(DeclarableOpsTests3, Test_ClipByNorm_3) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {1.0}, {1}); - auto z = result->at(0); + auto z = result.at(0); auto zNorm1 = z->reduceAlongDimension(reduce::Norm2, {1}, true); auto exp = NDArrayFactory::create('c', {3, 1}, {1., 1., xNorm1.e(2)}); @@ -349,7 +330,6 @@ TEST_F(DeclarableOpsTests3, Test_ClipByNorm_3) { ASSERT_TRUE(exp.isSameShape(&zNorm1)); ASSERT_TRUE(exp.equalsTo(&zNorm1)); - delete result; } TEST_F(DeclarableOpsTests3, Test_ListDiff_1) { @@ -362,10 +342,10 @@ TEST_F(DeclarableOpsTests3, Test_ListDiff_1) { sd::ops::listdiff op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z0 = result->at(0); - auto z1 = result->at(1); + auto z0 = result.at(0); + auto z1 = result.at(1); z0->getDataBuffer()->syncToSpecial(true); // force sync z1->getDataBuffer()->syncToSpecial(true); // force sync @@ -376,7 +356,6 @@ TEST_F(DeclarableOpsTests3, Test_ListDiff_1) { ASSERT_TRUE(exp1.isSameShape(z1)); ASSERT_TRUE(exp1.equalsTo(z1)); - delete result; } TEST_F(DeclarableOpsTests3, Test_Range_1) { @@ -388,14 +367,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_1) { sd::ops::range op; auto result = op.evaluate({&start, &stop, &step}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -408,14 +386,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_2) { sd::ops::range op; auto result = op.evaluate({&start, &stop, &step}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(DeclarableOpsTests3, Test_Range_3) { @@ -427,14 +404,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_3) { sd::ops::range op; auto result = op.evaluate({&start, &stop, &step}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -447,14 +423,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_10) { sd::ops::range op; auto result = op.evaluate({&start, &stop, &step}, {sd::DataType::DOUBLE}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -464,14 +439,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_4) { sd::ops::range op; auto result = op.evaluate({}, {-10., 10., 1.666}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -481,14 +455,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_5) { sd::ops::range op; auto result = op.evaluate({}, {2, 0, -1}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(DeclarableOpsTests3, Test_Range_6) { @@ -497,14 +470,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_6) { sd::ops::range op; auto result = op.evaluate({}, {0, 2, 1}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(DeclarableOpsTests3, Test_Range_7) { @@ -513,14 +485,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_7) { sd::ops::range op; auto result = op.evaluate({}, {10,-5,-1.666}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -531,14 +502,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_8) { sd::ops::range op; auto result = op.evaluate({}, {}, {2, 0, -1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(DeclarableOpsTests3, Test_Range_9) { @@ -547,14 +517,13 @@ TEST_F(DeclarableOpsTests3, Test_Range_9) { sd::ops::range op; auto result = op.evaluate({}, {}, {0, 2, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_1) { @@ -567,12 +536,12 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_1) { sd::ops::batched_gemm op; auto result = op.evaluate({&a, &b, &x, &x, &x, &y, &y, &y}, {}, {111, 111, 3, 3, 3, 3, 3, 3, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); for (int e = 0; e < 3; e++) { - auto z = result->at(e); + auto z = result.at(e); // exp->printIndexedBuffer("e"); // z->printIndexedBuffer("z"); @@ -582,7 +551,7 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_1) { } delete exp; - delete result; + } TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_2) { @@ -595,12 +564,12 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_2) { sd::ops::batched_gemm op; auto result = op.evaluate({&a, &b, &x, &x, &x, &y, &y, &y}, {}, {112, 112, 3, 3, 3, 3, 3, 3, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); for (int e = 0; e < 3; e++) { - auto z = result->at(e); + auto z = result.at(e); //exp->printIndexedBuffer("e"); //z->printIndexedBuffer("z"); @@ -610,7 +579,7 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_2) { } delete exp; - delete result; + } TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_3) { @@ -623,12 +592,12 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_3) { sd::ops::batched_gemm op; auto result = op.evaluate({&a, &b, &x, &x, &x, &y, &y, &y}, {}, {112, 111, 3, 3, 3, 3, 3, 3, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); for (int e = 0; e < 3; e++) { - auto z = result->at(e); + auto z = result.at(e); // exp->printIndexedBuffer("e"); // z->printIndexedBuffer("z"); @@ -638,7 +607,7 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_3) { } delete exp; - delete result; + } TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_4) { @@ -651,12 +620,12 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_4) { sd::ops::batched_gemm op; auto result = op.evaluate({&a, &b, &x, &x, &x, &y, &y, &y}, {}, {111, 111, 5, 4, 3, 5, 3, 5, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); for (int e = 0; e < 3; e++) { - auto z = result->at(e); + auto z = result.at(e); //exp->printIndexedBuffer("e"); //z->printIndexedBuffer("z"); @@ -666,7 +635,7 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_4) { } delete exp; - delete result; + } TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_5) { @@ -679,12 +648,12 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_5) { sd::ops::batched_gemm op; auto result = op.evaluate({&a, &b, &x, &x, &x, &y, &y, &y}, {}, {112, 112, 5, 4, 3, 3, 4, 5, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); for (int e = 0; e < 3; e++) { - auto z = result->at(e); + auto z = result.at(e); //exp->printIndexedBuffer("e"); //z->printIndexedBuffer("z"); @@ -694,7 +663,7 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_5) { } delete exp; - delete result; + } @@ -708,12 +677,12 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_6) { sd::ops::batched_gemm op; auto result = op.evaluate({&a, &b, &x, &x, &x, &y, &y, &y}, {}, {111, 111, 2, 3, 5, 2, 5, 2, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); for (int e = 0; e < 3; e++) { - auto z = result->at(e); + auto z = result.at(e); //exp->printIndexedBuffer("e"); //z->printIndexedBuffer("z"); @@ -723,7 +692,7 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_6) { } delete exp; - delete result; + } TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_7) { @@ -738,12 +707,12 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_7) { sd::ops::batched_gemm op; auto result = op.evaluate({&a, &b, &x, &x, &x, &y, &y, &y}, {}, {112, 112, 2, 3, 5, 5, 3, 2, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); for (int e = 0; e < 3; e++) { - auto z = result->at(e); + auto z = result.at(e); //exp->printIndexedBuffer("e"); //z->printIndexedBuffer("z"); @@ -753,7 +722,7 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_7) { } delete exp; - delete result; + } TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_Validation_1) { @@ -765,7 +734,7 @@ TEST_F(DeclarableOpsTests3, Test_Batched_Gemm_Validation_1) { sd::ops::batched_gemm op; try { auto result = op.evaluate({&a, &b, &x, &x, &x, &y, &y, &y}, {}, {112, 112, 2, 3, 5, 5, 3, 2, 3}); - delete result; + ASSERT_TRUE(false); } catch (std::invalid_argument &e) { // @@ -796,14 +765,13 @@ TEST_F(DeclarableOpsTests3, Test_ReverseDivide_1) { sd::ops::reversedivide op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } //////////////////////////////////////////////////////////////////// @@ -828,17 +796,16 @@ TEST_F(DeclarableOpsTests3, sruCell_test1) { sd::ops::sruCell op; auto results = op.evaluate({&xt, &ct_1, &w, &b}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; } @@ -864,17 +831,16 @@ TEST_F(DeclarableOpsTests3, sruCell_test2) { sd::ops::sruCell op; auto results = op.evaluate({&xt, &ct_1, &w, &b}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -899,17 +865,17 @@ TEST_F(DeclarableOpsTests3, sruCell_test3) { sd::ops::sruCell op; auto results = op.evaluate({&xt, &ct_1, &w, &b}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(0); - auto *ct = results->at(1); + auto *ht = results.at(0); + auto *ct = results.at(1); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); ASSERT_TRUE(expCt.isSameShape(ct)); ASSERT_TRUE(expCt.equalsTo(ct)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -938,14 +904,13 @@ TEST_F(DeclarableOpsTests3, gruCell_test1) { sd::ops::gruCell op; auto results = op.evaluate({&xt, &ht_1, &Wru, &Wc, &bru, &bc}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(3); + auto *ht = results.at(3); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -974,14 +939,14 @@ TEST_F(DeclarableOpsTests3, gruCell_test2) { sd::ops::gruCell op; auto results = op.evaluate({&xt, &ht_1, &Wru, &Wc, &bru, &bc}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *ht = results->at(3); + auto *ht = results.at(3); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); - delete results; + } //////////////////////////////////////////////////////////////////// @@ -1007,17 +972,17 @@ TEST_F(DeclarableOpsTests3, gruCell_test3) { auto expHt= NDArrayFactory::create('c', {batchSize, numUnits}, {0.1149149f, 0.1149149f, 0.1149149f, 0.1149149f, 0.1149149f, 0.1149149f, 0.1149149f, 0.1149149f}); + sd::ops::gruCell op; - auto results = op.evaluate({&xt, &ht_1, &Wru, &Wc, &bru, &bc}); + auto result = op.evaluate({&xt, &ht_1, &Wru, &Wc, &bru, &bc}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *ht = results->at(3); + auto *ht = result.at(3); ASSERT_TRUE(expHt.isSameShape(ht)); ASSERT_TRUE(expHt.equalsTo(ht)); - delete results; } //////////////////////////////////////////////////////////////////// @@ -1027,16 +992,16 @@ TEST_F(DeclarableOpsTests3, invertPermutation_test1) { auto expected= NDArrayFactory::create('c', {1, 8}, {7, 6, 1, 5, 3, 0, 4, 2}); sd::ops::invert_permutation op; - auto results = op.evaluate({&input}); + auto result = op.evaluate({&input}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1045,17 +1010,18 @@ TEST_F(DeclarableOpsTests3, invertPermutation_test2) { auto input= NDArrayFactory::create('c', {1, 8}, {5,2,7,4,6,3,1,0}); auto expected= NDArrayFactory::create('c', {1, 8}, {7, 6, 1, 5, 3, 0, 4, 2}); + sd::ops::invert_permutation op; - auto results = op.evaluate({&input}); + auto result = op.evaluate({&input}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1065,16 +1031,15 @@ TEST_F(DeclarableOpsTests3, invertPermutation_test3) { auto expected= NDArrayFactory::create('c', {1, 8}, {2, 0, 1, 5, 3, 6, 4, 7}); sd::ops::invert_permutation op; - auto results = op.evaluate({&input}); + auto result = op.evaluate({&input}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1086,16 +1051,15 @@ TEST_F(DeclarableOpsTests3, diag_test1) { auto expected= NDArrayFactory::create('c', {3,2,3,2}, {1,0,0,0,0,0, 0,2,0,0,0,0, 0,0,3,0,0,0, 0,0,0,4,0,0, 0,0,0,0,5,0, 0,0,0,0,0,6}); sd::ops::diag op; - auto results = op.evaluate({&input}); + auto result = op.evaluate({&input}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1107,16 +1071,15 @@ TEST_F(DeclarableOpsTests3, diag_test2) { auto expected= NDArrayFactory::create('c', {2,3,2,3}, {1,0,0,0,0,0, 0,2,0,0,0,0, 0,0,3,0,0,0, 0,0,0,4,0,0, 0,0,0,0,5,0, 0,0,0,0,0,6}); sd::ops::diag op; - auto results = op.evaluate({&input}); + auto result = op.evaluate({&input}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1128,22 +1091,18 @@ TEST_F(DeclarableOpsTests3, diag_test_vector) { auto expected= NDArrayFactory::create('c', {4,4}, {1,0,0,0, 0,2,0,0, 0,0,3,0,0,0,0,4}); sd::ops::diag op; - auto results = op.evaluate({input}); + auto result = op.evaluate({input}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = results->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; + delete input; } - - - TEST_F(DeclarableOpsTests3, diag_test_col_vector) { @@ -1152,16 +1111,16 @@ TEST_F(DeclarableOpsTests3, diag_test_col_vector) { auto expected= NDArrayFactory::create('c', {4,4}, {1,0,0,0, 0,2,0,0, 0,0,3,0,0,0,0,4}); sd::ops::diag op; - auto results = op.evaluate({input}, {}, {}); + auto result = op.evaluate({input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + delete input; } /////////////////////////////////////////////////////////////////// @@ -1173,16 +1132,15 @@ TEST_F(DeclarableOpsTests3, diag_test3) { auto expected= NDArrayFactory::create('c', {3,3}, {1,0,0, 0,2,0, 0,0,3}); sd::ops::diag op; - auto results = op.evaluate({&input}, {}, {}); + auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1194,16 +1152,15 @@ TEST_F(DeclarableOpsTests3, diag_test4) { auto expected= NDArrayFactory::create('c', {3,3}, {1,0,0, 0,2,0, 0,0,3}); sd::ops::diag op; - auto results = op.evaluate({&input}, {}, {}); + auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1215,16 +1172,15 @@ TEST_F(DeclarableOpsTests3, diag_test5) { auto expected= NDArrayFactory::create('c', {1,1}, {2}); sd::ops::diag op; - auto results = op.evaluate({&input}, {}, {}); + auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1236,16 +1192,15 @@ TEST_F(DeclarableOpsTests3, diag_test6) { auto expected= NDArrayFactory::create('c', {2,2,2,2,2,2}, {1,0,0,0, 0,0,0,0, 0,2,0,0, 0,0,0,0, 0,0,3,0, 0,0,0,0, 0,0,0,4, 0,0,0,0, 0,0,0,0, 5,0,0,0, 0,0,0,0, 0,6,0,0, 0,0,0,0, 0,0,7,0, 0,0,0,0, 0,0,0,8}); sd::ops::diag op; - auto results = op.evaluate({&input}, {}, {}); + auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1259,16 +1214,15 @@ TEST_F(DeclarableOpsTests3, matrixSetDiag_test1) { auto expected= NDArrayFactory::create('c', {4,3,2}, {1,0,0,1,0,0, 1,0,0,1,0,0, 1,0,0,1,0,0, 1,0,0,1,0,0}); sd::ops::matrix_set_diag op; - auto results = op.evaluate({&input, &diagonal}, {}, {}); + auto result = op.evaluate({&input, &diagonal}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1282,16 +1236,16 @@ TEST_F(DeclarableOpsTests3, matrixSetDiag_test2) { auto expected= NDArrayFactory::create('c', {1,1,2}, {1.f, 0.f}); sd::ops::matrix_set_diag op; - auto results = op.evaluate({&input, &diagonal}, {}, {}); + auto result = op.evaluate({&input, &diagonal}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1305,16 +1259,15 @@ TEST_F(DeclarableOpsTests3, matrixSetDiag_test3) { auto expected= NDArrayFactory::create('c', {2,1,4}, {1,0,0,0,1,0,0,0}); sd::ops::matrix_set_diag op; - auto results = op.evaluate({&input, &diagonal}, {}, {}); + auto result = op.evaluate({&input, &diagonal}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1328,16 +1281,15 @@ TEST_F(DeclarableOpsTests3, matrixSetDiag_test4) { auto expected= NDArrayFactory::create('c', {2,1,4,1}, {1,0,0,0,1,0,0,0}); sd::ops::matrix_set_diag op; - auto results = op.evaluate({&input, &diagonal}, {}, {}); + auto result = op.evaluate({&input, &diagonal}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1349,17 +1301,16 @@ TEST_F(DeclarableOpsTests3, diagPart_test1) { auto expected= NDArrayFactory::create('c', {2}, {1,4}); sd::ops::diag_part op; - auto results = op.evaluate({&input}, {}, {}); + auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); // output->printBuffer(); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1371,16 +1322,15 @@ TEST_F(DeclarableOpsTests3, diagPart_test2) { auto expected= NDArrayFactory::create('c', {2,2}, {1,6,11,16}); sd::ops::diag_part op; - auto results = op.evaluate({&input}, {}, {}); + auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1392,16 +1342,15 @@ TEST_F(DeclarableOpsTests3, diagPart_test3) { auto expected= NDArrayFactory::create('c', {2,2,2}, {1,10,19,28,37,46,55,64}); sd::ops::diag_part op; - auto results = op.evaluate({&input}, {}, {}); + auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1418,16 +1367,15 @@ TEST_F(DeclarableOpsTests3, betainc_test1) { auto expected = NDArrayFactory::create('c', {3,3}, {0.40638509f, 0.33668978f, 0.28271242f, 0.23973916f, 0.20483276f, 0.17604725f, 0.15203027f, 0.13180567f, 0.114647f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = results->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output, 1e-2)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1444,16 +1392,15 @@ TEST_F(DeclarableOpsTests3, betainc_test2) { auto expected= NDArrayFactory::create('c', {3,3}, {0.40638509f, 0.33668978f, 0.28271242f, 0.23973916f, 0.20483276f, 0.17604725f, 0.15203027f, 0.13180567f, 0.114647f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1470,16 +1417,15 @@ TEST_F(DeclarableOpsTests3, betainc_test3) { auto expected= NDArrayFactory::create('c', {3,3}, {0.40638509f, 0.33668978f, 0.28271242f, 0.23973916f, 0.20483276f, 0.17604725f, 0.15203027f, 0.13180567f, 0.114647f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1496,16 +1442,15 @@ TEST_F(DeclarableOpsTests3, betainc_test4) { auto expected= NDArrayFactory::create('c', {3,3}, {1.00000000e-01f, 2.80000000e-02f, 8.56000000e-03f, 2.72800000e-03f, 8.90920000e-04f, 2.95706080e-04f, 9.92854864e-05f, 3.36248880e-05f, 1.14644360e-05f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output, 1e-6)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1522,16 +1467,15 @@ TEST_F(DeclarableOpsTests3, betainc_test5) { auto expected= NDArrayFactory::create('c', {3,3}, {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output, 1e-6)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1548,16 +1492,15 @@ TEST_F(DeclarableOpsTests3, betainc_test6) { auto expected= NDArrayFactory::create('c', {3,3}, {3.92988233e-06f, 1.35306497e-06f, 4.67576826e-07f, 1.62083416e-07f, 5.63356971e-08f, 1.96261318e-08f, 6.85120307e-09f, 2.39594668e-09f, 8.39227685e-10f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output, 1e-6)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1574,16 +1517,15 @@ TEST_F(DeclarableOpsTests3, betainc_test7) { auto expected= NDArrayFactory::create('c', {3,3}, {0.99999607f, 0.99999865f, 0.99999953f, 0.99999984f, 0.99999994f, 0.99999998f, 0.99999999f, 1.f, 1.f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output, 1e-6)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1600,16 +1542,16 @@ TEST_F(DeclarableOpsTests3, betainc_test8) { auto expected= NDArrayFactory::create('c', {3,3}, {1.f, 1.f, 1.f,1.f,1.f,1.f,1.f,1.f,1.f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output, 1e-6)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1626,16 +1568,15 @@ TEST_F(DeclarableOpsTests3, betainc_test9) { auto expected= NDArrayFactory::create('c', {3,3}, {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1652,16 +1593,15 @@ TEST_F(DeclarableOpsTests3, betainc_test10) { auto expected= NDArrayFactory::create('c', {3,3}, {0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f}); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1673,16 +1613,15 @@ TEST_F(DeclarableOpsTests3, betainc_test11) { NDArray expected('c', {4}, {0.912156, 0.634460, 0.898314, 0.624538}, sd::DataType::FLOAT32); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1695,16 +1634,15 @@ TEST_F(DeclarableOpsTests3, betainc_test12) { NDArray expected('c', {4}, {0.9999995 , 0.8594694 , 0.999988 , 0.49124345}, sd::DataType::FLOAT32); sd::ops::betainc op; - auto results = op.evaluate({&a, &b, &x}, {}, {}); + auto result = op.evaluate({&a, &b, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1719,16 +1657,15 @@ TEST_F(DeclarableOpsTests3, zeta_test1) { auto expected= NDArrayFactory::create('c', {3,3}, {1.64493407f, 0.64493407f, 0.39493407f, 0.28382296f, 0.22132296f, 0.18132296f, 0.15354518f, 0.13313701f, 0.11751201f}); sd::ops::zeta op; - auto results = op.evaluate({&x, &q}, {}, {}); + auto result = op.evaluate({&x, &q}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1743,16 +1680,16 @@ TEST_F(DeclarableOpsTests3, zeta_test2) { auto expected= NDArrayFactory::create('c', {3,3}, {0.10516634f, 0.09516634f, 0.08690187f, 0.07995743f, 0.07404027f, 0.06893823f, 0.06449378f, 0.06058753f, 0.05712733f}); sd::ops::zeta op; - auto results = op.evaluate({&x, &q}, {}, {}); + auto result = op.evaluate({&x, &q}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1767,16 +1704,16 @@ TEST_F(DeclarableOpsTests3, zeta_test3) { auto expected= NDArrayFactory::create('c', {3,3}, {0.01005017f, 0.00995017f, 0.00985214f, 0.00975602f, 0.00966176f, 0.0095693f, 0.0094786f, 0.0093896f, 0.00930226f}); sd::ops::zeta op; - auto results = op.evaluate({&x, &q}, {}, {}); + auto result = op.evaluate({&x, &q}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); - auto *output = results->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } @@ -1792,16 +1729,14 @@ TEST_F(DeclarableOpsTests3, zeta_test4) { auto expected= NDArrayFactory::create('c', {3,3}, {0.01005017f, 0.00995017f, 0.00985214f, 0.00975602f, 0.00966176f, 0.0095693f, 0.0094786f, 0.0093896f, 0.00930226f}); sd::ops::zeta op; - auto results = op.evaluate({&x, &q}, {}, {}); + auto result = op.evaluate({&x, &q}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - - delete results; } /////////////////////////////////////////////////////////////////// @@ -1815,17 +1750,17 @@ TEST_F(DeclarableOpsTests3, zeta_test5) { auto expected= NDArrayFactory::create('c', {3,3}, {10.58444846f, 9.58444846f, 9.11793197f, 8.81927915f, 8.60164151f, 8.43137352f, 8.29204706f, 8.17445116f, 8.07291961f}); + sd::ops::zeta op; - auto results = op.evaluate({&x, &q}, {}, {}); + auto result = op.evaluate({&x, &q}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1840,16 +1775,15 @@ TEST_F(DeclarableOpsTests3, zeta_test6) { auto expected= NDArrayFactory::create('c', {3,3}, {100.57794334f, 99.57794334f, 99.08139709f, 98.75170576f, 98.50514758f, 98.30834069f, 98.1446337f, 98.00452955f, 97.88210202f}); sd::ops::zeta op; - auto results = op.evaluate({&x, &q}, {}, {}); + auto result = op.evaluate({&x, &q}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1863,17 +1797,17 @@ TEST_F(DeclarableOpsTests3, zeta_test7) { auto expected= NDArrayFactory::create('c', {3,3}, {1.00099458e+00f, 9.94575128e-04f, 1.80126278e-05f, 1.07754001e-06f, 1.23865693e-07f, 2.14656932e-08f, 4.92752156e-09f, 1.38738839e-09f, 4.56065812e-10f}); + sd::ops::zeta op; - auto results = op.evaluate({&x, &q}, {}, {}); + auto result = op.evaluate({&x, &q}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -1888,16 +1822,16 @@ TEST_F(DeclarableOpsTests3, zeta_test8) { auto expected= NDArrayFactory::create('c', {3,4}, {23.014574, 12.184081, 8.275731, 6.1532226, 4.776538, 3.7945523, 3.0541048, 2.4765317, 2.0163891, 205.27448, 21.090889, 19.477398}); sd::ops::zeta op; - auto results = op.evaluate({&x, &q}, {}, {}); + auto result = op.evaluate({&x, &q}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *output = results->at(0); + auto *output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1917,12 +1851,12 @@ TEST_F(DeclarableOpsTests3, zeta_test9) { ASSERT_EQ(ND4J_STATUS_OK, results); - //auto *output = results->at(0); + //auto *output = result.at(0); // z.printIndexedBuffer("Zeta output"); ASSERT_TRUE(expected.isSameShape(z)); ASSERT_TRUE(expected.equalsTo(z)); -// delete results; +// } /////////////////////////////////////////////////////////////////// @@ -1942,12 +1876,12 @@ TEST_F(DeclarableOpsTests3, zeta_test10) { ASSERT_EQ(ND4J_STATUS_OK, results); - //auto *output = results->at(0); + //auto *output = result.at(0); // z.printIndexedBuffer("Zeta output"); ASSERT_TRUE(expected.isSameShape(z)); ASSERT_TRUE(expected.equalsTo(z)); -// delete results; +// } @@ -1974,19 +1908,19 @@ TEST_F(DeclarableOpsTests3, polygamma_test1) { x.assign(0.5); auto expected= NDArrayFactory::create('c', {3,3}, {4.934802, -16.828796, 97.409088, -771.474243, 7691.113770, -92203.460938, 1290440.250000, -20644900.000000, 3.71595e+08}); - + sd::ops::polygamma op; - auto results = op.evaluate({&n, &x}, {}, {}); + auto result = op.evaluate({&n, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = results->at(0); + auto output = result.at(0); // output->printBuffer(); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2003,16 +1937,15 @@ TEST_F(DeclarableOpsTests3, polygamma_test2) { //ASSERT_FALSE(true); sd::ops::polygamma op; - auto results = op.evaluate({&n, &x}, {}, {}); + auto result = op.evaluate({&n, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = results->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2025,17 +1958,17 @@ TEST_F(DeclarableOpsTests3, polygamma_test3) { x.linspace(10.); auto expected= NDArrayFactory::create('c', {3,3}, {1.05166336e-01,-9.04983497e-03, 1.31009323e-03,-2.44459433e-04, 5.31593880e-05,-1.28049888e-05, 3.31755364e-06,-9.07408791e-07, 2.58758130e-07}); + sd::ops::polygamma op; - auto results = op.evaluate({&n, &x}, {}, {}); + auto result = op.evaluate({&n, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = results->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } TEST_F(DeclarableOpsTests3, polygamma_test4) { @@ -2047,16 +1980,15 @@ TEST_F(DeclarableOpsTests3, polygamma_test4) { 1.596005e+03, -4.876665e+03,4.510025e+04, -1.730340e+08, 6.110257e+05, -1.907087e+07}, sd::DataType::DOUBLE); sd::ops::polygamma op; - auto results = op.evaluate({&n, &x}, {}, {}); + auto result = op.evaluate({&n, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = results->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } TEST_F(DeclarableOpsTests3, digamma_1) { @@ -2067,16 +1999,15 @@ TEST_F(DeclarableOpsTests3, digamma_1) { std::numeric_limits::infinity(),-5.28904,-0.577216, 0.03649, 0.544293, 1.549434,2.917892, 3.020524, 3.077401}, sd::DataType::DOUBLE); sd::ops::digamma op; - auto results = op.evaluate({&x}, {}, {}); + auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = results->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2088,13 +2019,13 @@ TEST_F(DeclarableOpsTests3, svd_test1) { auto expV= NDArrayFactory::create('c', {6,6}, {-0.24577,-0.24512, 0.00401,-0.04585,-0.62058, 0.70162, 0.27937, 0.75961, 0.43885,-0.06857,-0.3839 , 0.01669,-0.35944,-0.09629, 0.44593, 0.78602,-0.09103,-0.19125, 0.53973, 0.07613,-0.10721, 0.49559, 0.35687, 0.56431,-0.6226 , 0.39742, 0.12785,-0.15716, 0.52372, 0.37297, 0.23113,-0.43578, 0.76204,-0.32414, 0.23996, 0.11543}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {1, 1, 16}); + auto result = op.evaluate({&x}, {}, {1, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); - auto *u = results->at(1); - auto *v = results->at(2); + auto *s = result.at(0); + auto *u = result.at(1); + auto *v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2113,7 +2044,6 @@ TEST_F(DeclarableOpsTests3, svd_test1) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2125,13 +2055,13 @@ TEST_F(DeclarableOpsTests3, svd_test2) { auto expV= NDArrayFactory::create('c', {6,6}, {0.2508 ,-0.2265 , 0.01689, 0.04486, 0.53132, 0.77537,-0.32281, 0.74559, 0.41845, -0.13821, 0.37642, 0.06315, 0.33139,-0.05528, 0.47186, 0.73171, 0.18905, -0.3055 ,-0.57263, 0.06276,-0.09542, 0.59396, -0.36152, 0.419 , 0.59193, 0.4361 , 0.13557, -0.03632, -0.5755 , 0.32944,-0.21165,-0.44227, 0.75794, -0.29895, -0.27993, 0.13187}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {1, 1, 16}); + auto result = op.evaluate({&x}, {}, {1, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); - auto *u = results->at(1); - auto *v = results->at(2); + auto *s = result.at(0); + auto *u = result.at(1); + auto *v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2150,7 +2080,6 @@ TEST_F(DeclarableOpsTests3, svd_test2) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2162,13 +2091,13 @@ TEST_F(DeclarableOpsTests3, svd_test3) { auto expV= NDArrayFactory::create('c', {6,6}, {0.2508 ,-0.2265 , 0.01689, 0.04486, 0.53132, 0.77537,-0.32281, 0.74559, 0.41845, -0.13821, 0.37642, 0.06315, 0.33139,-0.05528, 0.47186, 0.73171, 0.18905, -0.3055 ,-0.57263, 0.06276,-0.09542, 0.59396, -0.36152, 0.419 , 0.59193, 0.4361 , 0.13557, -0.03632, -0.5755 , 0.32944,-0.21165,-0.44227, 0.75794, -0.29895, -0.27993, 0.13187}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {0, 1, 16}); + auto result = op.evaluate({&x}, {}, {0, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); - auto *u = results->at(1); - auto *v = results->at(2); + auto *s = result.at(0); + auto *u = result.at(1); + auto *v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2187,7 +2116,6 @@ TEST_F(DeclarableOpsTests3, svd_test3) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5f); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2199,13 +2127,13 @@ TEST_F(DeclarableOpsTests3, svd_test4) { auto expV= NDArrayFactory::create('c', {7,7}, {-0.35914, 0.68966, -0.30077, -0.15238, -0.48179, 0.14716, -0.16709, 0.21989, -0.34343, 0.11086, -0.78381, -0.37902, 0.24224, -0.06862, 0.32179, 0.12812, -0.25812, 0.0691 , -0.12891, 0.26979, 0.84807,-0.50833, 0.13793, 0.06658, -0.53001, 0.52572, -0.16194, 0.36692, 0.48118, 0.15876, -0.65132, -0.24602, 0.3963 , -0.16651, -0.27155,-0.31605, -0.46947, -0.50195, 0.0378 , -0.34937, -0.53062, 0.15069, 0.35957, 0.35408, 0.38732, -0.12154, -0.22827, -0.7151 , 0.13065}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {1, 1, 16}); + auto result = op.evaluate({&x}, {}, {1, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); - auto *u = results->at(1); - auto *v = results->at(2); + auto *s = result.at(0); + auto *u = result.at(1); + auto *v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2224,7 +2152,6 @@ TEST_F(DeclarableOpsTests3, svd_test4) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5f); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2236,13 +2163,13 @@ TEST_F(DeclarableOpsTests3, svd_test5) { auto expV= NDArrayFactory::create('c', {7,6}, {-0.35914, 0.68966, -0.30077, -0.15238, -0.48179, 0.14716, 0.21989, -0.34343, 0.11086, -0.78381, -0.37902, 0.24224, 0.32179, 0.12812, -0.25812, 0.0691 , -0.12891, 0.26979,-0.50833, 0.13793, 0.06658, -0.53001, 0.52572, -0.16194, 0.48118, 0.15876, -0.65132, -0.24602, 0.3963 , -0.16651,-0.31605, -0.46947, -0.50195, 0.0378 , -0.34937, -0.53062, 0.35957, 0.35408, 0.38732, -0.12154, -0.22827, -0.7151}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {0, 1, 16}); + auto result = op.evaluate({&x}, {}, {0, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); - auto *u = results->at(1); - auto *v = results->at(2); + auto *s = result.at(0); + auto *u = result.at(1); + auto *v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2261,7 +2188,6 @@ TEST_F(DeclarableOpsTests3, svd_test5) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5f); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2291,13 +2217,13 @@ TEST_F(DeclarableOpsTests3, svd_test6) { -0.51827, -0.31837, -0.16732, 0.71378, -0.30425,-0.39314, 0.15266, 0.63693, -0.30945, -0.5663 ,-0.51981, 0.03325, 0.37603, 0.05147, 0.76462,-0.01282, 0.92491, -0.08042, 0.36977, -0.03428}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {1, 1, 16}); + auto result = op.evaluate({&x}, {}, {1, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); - auto *u = results->at(1); - auto *v = results->at(2); + auto *s = result.at(0); + auto *u = result.at(1); + auto *v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2316,7 +2242,6 @@ TEST_F(DeclarableOpsTests3, svd_test6) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5f); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2328,16 +2253,17 @@ TEST_F(DeclarableOpsTests3, svd_test7) { auto expS= NDArrayFactory::create('c', {2,2,5}, {40.95395, 31.46869, 24.79993, 12.33768, 1.80031,38.18412, 31.52287, 23.52755, 11.79484, 1.90195, 39.34498, 32.54861, 17.52492, 7.03003, 2.2399,44.72126, 32.3164 , 16.60139, 6.88783, 0.78122}); + sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {0, 0, 16}); + auto result = op.evaluate({&x}, {}, {0, 0, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); + auto *s = result.at(0); ASSERT_TRUE(expS.equalsTo(s)); ASSERT_TRUE(expS.isSameShape(s)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2467,11 +2393,11 @@ TEST_F(DeclarableOpsTests3, svd_test7) { // sd::ops::svd op; // auto results = op.execute({&x}, {}, {1, 1, 7}); -// ASSERT_EQ(ND4J_STATUS_OK, results->status()); +// ASSERT_EQ(ND4J_STATUS_OK, result.status()); -// auto *s = results->at(0); -// auto *u = results->at(1); -// auto *v = results->at(2); +// auto *s = result.at(0); +// auto *u = result.at(1); +// auto *v = result.at(2); // ASSERT_TRUE(expS.isSameShape(s)); // ASSERT_TRUE(expU.isSameShape(u)); @@ -2490,7 +2416,7 @@ TEST_F(DeclarableOpsTests3, svd_test7) { // ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5); // } -// delete results; +// // } /////////////////////////////////////////////////////////////////// @@ -2528,13 +2454,13 @@ TEST_F(DeclarableOpsTests3, svd_test9) { 1.31650000e-01, 7.57150000e-01, -4.89030000e-01, 3.47710000e-01,-4.39400000e-02, 2.17750000e-01,-6.57270000e-01, 2.91000000e-01, 4.17280000e-01, 2.52880000e-01,-4.63400000e-01, -1.74620000e-01}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {1, 1, 16}); + auto result = op.evaluate({&x}, {}, {1, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); - auto *u = results->at(1); - auto *v = results->at(2); + auto *s = result.at(0); + auto *u = result.at(1); + auto *v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2553,7 +2479,6 @@ TEST_F(DeclarableOpsTests3, svd_test9) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2587,13 +2512,13 @@ TEST_F(DeclarableOpsTests3, svd_test10) { -4.39400000e-02,-6.57270000e-01, 2.91000000e-01, 4.17280000e-01, 2.52880000e-01,-4.63400000e-01}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {0, 1, 16}); + auto result = op.evaluate({&x}, {}, {0, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto *s = results->at(0); - auto *u = results->at(1); - auto *v = results->at(2); + auto *s = result.at(0); + auto *u = result.at(1); + auto *v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2612,7 +2537,6 @@ TEST_F(DeclarableOpsTests3, svd_test10) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2632,13 +2556,13 @@ TEST_F(DeclarableOpsTests3, svd_test11) { -0.43596, 0.83108, -0.34531}); sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {0, 1, 16}); + auto result = op.evaluate({&x}, {}, {0, 1, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto s = results->at(0); - auto u = results->at(1); - auto v = results->at(2); + auto s = result.at(0); + auto u = result.at(1); + auto v = result.at(2); ASSERT_TRUE(expS.isSameShape(s)); ASSERT_TRUE(expU.isSameShape(u)); @@ -2657,7 +2581,6 @@ TEST_F(DeclarableOpsTests3, svd_test11) { ASSERT_NEAR(sd::math::nd4j_abs(expV.e(i)), sd::math::nd4j_abs(v->e(i)), 1e-5); } - delete results; } /////////////////////////////////////////////////////////////////// @@ -2666,17 +2589,17 @@ TEST_F(DeclarableOpsTests3, svd_test12) { NDArray x('c', {4,3}, {1.7787856,0.80119777,0.72437465,0.23089433,1.7271413,0.18039072,0.50563407,0.89252293,1.5461209,0.92336726,0.085571885,0.79378015}); NDArray expS('c', {3}, {3.024703, 1.459483, 1.026371}); + sd::ops::svd op; - auto results = op.evaluate({&x}, {}, {1, 0, 16}); + auto result = op.evaluate({&x}, {}, {1, 0, 16}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto s = results->at(0); + auto s = result.at(0); ASSERT_TRUE(expS.equalsTo(s)); ASSERT_TRUE(expS.isSameShape(s)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2686,14 +2609,13 @@ TEST_F(DeclarableOpsTests3, elu_test1) { auto exp = NDArrayFactory::create('c', {3,3}, {.1, .2, .3, 0.5*-0.32968, 0.5*-0.393469, 0.5*-0.451188, .7, .8, .9}); sd::ops::elu op; - auto results = op.evaluate({&x}, {0.5}, {}); + auto result = op.evaluate({&x}, {0.5}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto s = results->at(0); + auto s = result.at(0); ASSERT_TRUE(exp.equalsTo(s)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2705,14 +2627,13 @@ TEST_F(DeclarableOpsTests3, elu_bp_test1) { auto exp = NDArrayFactory::create('c', {3, 3}, {2, 2, 2, 0.5*1.34064, 0.5*1.213061, 0.5*1.097623, 2, 2, 2}); sd::ops::elu_bp op; - auto results = op.evaluate({ &x, &eps }, {0.5}, {}); + auto result = op.evaluate({ &x, &eps }, {0.5}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto s = results->at(0); + auto s = result.at(0); ASSERT_TRUE(exp.equalsTo(s)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2722,14 +2643,13 @@ TEST_F(DeclarableOpsTests3, lrelu_test1) { auto exp = NDArrayFactory::create('c', {3,3}, {1, 2, 3, -0.8, -1., -1.2, 7, 8, 9}); sd::ops::lrelu op; - auto results = op.evaluate({&x}, {0.2}, {}); + auto result = op.evaluate({&x}, {0.2}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto s = results->at(0); + auto s = result.at(0); ASSERT_TRUE(exp.equalsTo(s)); - delete results; } TEST_F(DeclarableOpsTests3, lrelu_bp_test1) { @@ -2739,14 +2659,13 @@ TEST_F(DeclarableOpsTests3, lrelu_bp_test1) { auto exp = NDArrayFactory::create('c', {3,3}, {2, 2, 2, 0.4, 0.4, 0.4, 2, 2, 2}); sd::ops::lrelu_bp op; - auto results = op.evaluate({&x, &eps}, {0.2}, {}); + auto result = op.evaluate({&x, &eps}, {0.2}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto s = results->at(0); + auto s = result.at(0); ASSERT_TRUE(exp.equalsTo(s)); - delete results; } /////////////////////////////////////////////////////////////////// @@ -2756,14 +2675,13 @@ TEST_F(DeclarableOpsTests3, selu_test1) { auto exp = NDArrayFactory::create('c', {3,3}, {1.050701, 2.101402, 3.152103, -1.725899, -1.746253, -1.753742, 7.354907, 8.405608, 9.456309}); sd::ops::selu op; - auto results = op.evaluate({&x}, {}, {}); + auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto s = results->at(0); + auto s = result.at(0); ASSERT_TRUE(exp.equalsTo(s)); - delete results; } TEST_F(DeclarableOpsTests3, selu_test2) { @@ -2774,17 +2692,16 @@ TEST_F(DeclarableOpsTests3, selu_test2) { auto exp = NDArrayFactory::create('c', {3,3}, {2.101401, 2.101402, 2.101402, 0.064401, 0.023692, 0.008716, 2.101402, 2.101402, 2.101402}); sd::ops::selu_bp op; - auto results = op.evaluate({&x, &eps}, {0.2}, {}); + auto result = op.evaluate({&x, &eps}, {0.2}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto s = results->at(0); -// auto u = results->at(1); -// auto v = results->at(2); + auto s = result.at(0); +// auto u = result.at(1); +// auto v = result.at(2); // s->printIndexedBuffer("SELU_BP"); ASSERT_TRUE(exp.equalsTo(s)); - delete results; } TEST_F(DeclarableOpsTests3, EQScalarTests_1) { @@ -2929,6 +2846,5 @@ TEST_F(DeclarableOpsTests3, NOOPTests_1) { sd::ops::noop op; auto res = op.evaluate({&x, &scalar}, {}, {}); - ASSERT_TRUE(res->status() == sd::Status::OK()); - delete res; + ASSERT_TRUE(res.status() == sd::Status::OK()); } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests4.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests4.cpp index 830266f0a..d930fcc36 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests4.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests4.cpp @@ -66,14 +66,14 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_1) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -87,14 +87,14 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_2) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 0, 0, 1, 1, 0, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -108,14 +108,14 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_3) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 0, 0, 1, 1, 1, 0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -128,14 +128,14 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_4) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 0, 0, 1, 1, 0, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -149,14 +149,14 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_5) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -170,14 +170,14 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_6) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 1, 1, 1, 1, 0, 1, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -191,14 +191,14 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_7) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 2, 2, 0, 0, 1, 1, 1, 0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -211,14 +211,14 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_8) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 1, 1, 0, 0, 1, 1, 0, 0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -232,9 +232,9 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_9) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {}, {2, 2, 1, 1, 0, 0, 1, 1, 1, 0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printShapeInfo("z shape:"); //z->printBuffer("z buffer:"); @@ -242,7 +242,7 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_9) { ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -263,9 +263,9 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_10) { sd::ops::avgpool2d op; auto result = op.evaluate({&input}, {3,3, 3,3, 0,0, 1,1,1, 0,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("z"); // exp.printIndexedBuffer("e"); @@ -273,7 +273,7 @@ TYPED_TEST(TypedDeclarableOpsTests4, avgpool2d_10) { ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -287,9 +287,9 @@ TEST_F(DeclarableOpsTests4, avgpool2d_11) { sd::ops::avgpool2d op; auto result = op.evaluate({&x}, {3,3, 1,1, 0,0, 1,1, 1, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); int totalPadHeight = (inOutH - 1) * 1 + 3 - inOutH; int padTop = totalPadHeight / 2; @@ -339,7 +339,7 @@ TEST_F(DeclarableOpsTests4, avgpool2d_11) { ASSERT_EQ(m, *z); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -363,9 +363,9 @@ TEST_F(DeclarableOpsTests4, avgpool2d_12) { sd::ops::avgpool2d op; auto results = op.evaluate({&input}, {kH,kW, sH,sW, pH,pW, dH,dW, paddingMode, 0, dataFormat}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); //output->printIndexedBuffer("output"); //expected.printIndexedBuffer("expected"); @@ -373,7 +373,7 @@ TEST_F(DeclarableOpsTests4, avgpool2d_12) { ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -539,14 +539,14 @@ TEST_F(DeclarableOpsTests4, biasadd_1) { sd::ops::biasadd op; auto result = op.evaluate({&x, &bias}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, biasadd_2) { @@ -557,14 +557,14 @@ TEST_F(DeclarableOpsTests4, biasadd_2) { sd::ops::biasadd op; auto result = op.evaluate({&x, &bias}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, biasadd_3) { @@ -575,13 +575,13 @@ TEST_F(DeclarableOpsTests4, biasadd_3) { sd::ops::biasadd op; auto result = op.evaluate({&x, &row}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -598,10 +598,10 @@ TEST_F(DeclarableOpsTests4, biasadd_bp_1) { sd::ops::biasadd_bp op; auto result = op.evaluate({&x, &bias, &gradO}, {}, {}, {false}); // NHWC - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto gradI = result->at(0); - auto gradB = result->at(1); + auto gradI = result.at(0); + auto gradB = result.at(1); ASSERT_TRUE(gradI->isSameShape(gradO)); ASSERT_TRUE(gradI->equalsTo(gradO)); @@ -609,7 +609,7 @@ TEST_F(DeclarableOpsTests4, biasadd_bp_1) { ASSERT_TRUE(gradB->isSameShape(expGradB)); ASSERT_TRUE(gradB->equalsTo(expGradB)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -626,10 +626,10 @@ TEST_F(DeclarableOpsTests4, biasadd_bp_2) { sd::ops::biasadd_bp op; auto result = op.evaluate({&x, &bias, &gradO}, {}, {}, {true}); // NCHW - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto gradI = result->at(0); - auto gradB = result->at(1); + auto gradI = result.at(0); + auto gradB = result.at(1); ASSERT_TRUE(gradI->isSameShape(gradO)); ASSERT_TRUE(gradI->equalsTo(gradO)); @@ -637,7 +637,7 @@ TEST_F(DeclarableOpsTests4, biasadd_bp_2) { ASSERT_TRUE(gradB->isSameShape(expGradB)); ASSERT_TRUE(gradB->equalsTo(expGradB)); - delete result; + } TEST_F(DeclarableOpsTests4, biasadd_4) { @@ -665,14 +665,14 @@ TEST_F(DeclarableOpsTests4, Test_Fill_1) { sd::ops::fill op; auto result = op.evaluate({&x, &v}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_FirasSparce_1) { @@ -686,15 +686,15 @@ TEST_F(DeclarableOpsTests4, Test_FirasSparce_1) { sd::ops::firas_sparse op; auto result = op.evaluate({&x}, {0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("FIRAS"); // z->printShapeInfo("OUTSHAPE"); // ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_FlattenTests_1) { @@ -706,14 +706,14 @@ TEST_F(DeclarableOpsTests4, Test_FlattenTests_1) { sd::ops::flatten op; auto result = op.evaluate({&x}, {}, {'c'}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Flatten1"); // z->printShapeInfo("Flatten1 shape"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_FlattenTests_2) { @@ -726,15 +726,15 @@ TEST_F(DeclarableOpsTests4, Test_FlattenTests_2) { exp.linspace(1); sd::ops::flatten op; auto result = op.evaluate({&x, &y}, {}, {'c'}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Flatten2"); // z->printShapeInfo("Flatten2 shape"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_FlattenTests_3) { @@ -746,13 +746,13 @@ TEST_F(DeclarableOpsTests4, Test_FlattenTests_3) { sd::ops::flatten op; auto result = op.evaluate({&x, &y}, {}, {'c'}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_FlattenTests_4) { @@ -764,13 +764,13 @@ TEST_F(DeclarableOpsTests4, Test_FlattenTests_4) { sd::ops::flatten op; auto result = op.evaluate({&x, &y}, {}, {'f'}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_FloorTests_1) { @@ -781,14 +781,14 @@ TEST_F(DeclarableOpsTests4, Test_FloorTests_1) { sd::ops::Floor op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Flatten1"); // z->printShapeInfo("Flatten1 shape"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_Reshape_Again) { @@ -801,12 +801,12 @@ TEST_F(DeclarableOpsTests4, Test_Reshape_Again) { sd::ops::reshape op; auto result = op.evaluate({&x}, {-99, 4, 3}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_Split_1) { @@ -829,13 +829,13 @@ TEST_F(DeclarableOpsTests4, Test_Split_1) { sd::ops::split_v op; auto result = op.evaluate({&x, &sizes}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); - auto z0 = result->at(0); - auto z1 = result->at(1); - auto z2 = result->at(2); + auto z0 = result.at(0); + auto z1 = result.at(1); + auto z2 = result.at(2); ASSERT_TRUE(sub0.isSameShape(z0)); ASSERT_TRUE(sub1.isSameShape(z1)); @@ -845,7 +845,7 @@ TEST_F(DeclarableOpsTests4, Test_Split_1) { ASSERT_TRUE(sub1.equalsTo(z1)); ASSERT_TRUE(sub2.equalsTo(z2)); - delete result; + } // special test for TF mode, when axis goes first @@ -871,12 +871,12 @@ TEST_F(DeclarableOpsTests4, Test_Split_2) { sd::ops::split op; auto result = op.evaluate({&axis, &x}, {}, {4}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z0 = result->at(0); - auto z1 = result->at(1); - auto z2 = result->at(2); - auto z3 = result->at(3); + auto z0 = result.at(0); + auto z1 = result.at(1); + auto z2 = result.at(2); + auto z3 = result.at(3); ASSERT_TRUE(sub0.isSameShape(z0)); ASSERT_TRUE(sub1.isSameShape(z1)); @@ -888,7 +888,7 @@ TEST_F(DeclarableOpsTests4, Test_Split_2) { ASSERT_TRUE(sub2.equalsTo(z2)); ASSERT_TRUE(sub3.equalsTo(z3)); - delete result; + } // special test for TF mode, when axis goes first @@ -910,11 +910,11 @@ TEST_F(DeclarableOpsTests4, Test_Split_3) { sd::ops::split op; auto result = op.evaluate({&axis, &x}, {}, {3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z0 = result->at(0); - auto z1 = result->at(1); - auto z2 = result->at(2); + auto z0 = result.at(0); + auto z1 = result.at(1); + auto z2 = result.at(2); ASSERT_TRUE(sub0.isSameShape(z0)); ASSERT_TRUE(sub1.isSameShape(z1)); @@ -924,7 +924,7 @@ TEST_F(DeclarableOpsTests4, Test_Split_3) { ASSERT_TRUE(sub1.equalsTo(z1)); ASSERT_TRUE(sub2.equalsTo(z2)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_Squeeze_args_1) { @@ -933,14 +933,14 @@ TEST_F(DeclarableOpsTests4, Test_Squeeze_args_1) { sd::ops::squeeze op; auto result = op.evaluate({&x}, {}, {1, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_Squeeze_args_2) { @@ -950,14 +950,14 @@ TEST_F(DeclarableOpsTests4, Test_Squeeze_args_2) { sd::ops::squeeze op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -967,14 +967,14 @@ TEST_F(DeclarableOpsTests4, Test_Squeeze_args_3) { sd::ops::squeeze op; auto result = op.evaluate({&x}, {}, {-2, -3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_SpaceToDepth_1) { @@ -983,14 +983,14 @@ TEST_F(DeclarableOpsTests4, Test_SpaceToDepth_1) { sd::ops::space_to_depth op; auto result = op.evaluate({&x}, {}, {2, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_SpaceToDepth_2) { @@ -999,14 +999,14 @@ TEST_F(DeclarableOpsTests4, Test_SpaceToDepth_2) { sd::ops::space_to_depth op; auto result = op.evaluate({&x}, {}, {2, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -1016,14 +1016,14 @@ TEST_F(DeclarableOpsTests4, Test_DepthToSpace_1) { sd::ops::depth_to_space op; auto result = op.evaluate({&x}, {}, {2, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -1033,14 +1033,14 @@ TEST_F(DeclarableOpsTests4, Test_DepthToSpace_2) { sd::ops::depth_to_space op; auto result = op.evaluate({&x}, {}, {2, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_DepthToSpace_3) { @@ -1049,13 +1049,13 @@ TEST_F(DeclarableOpsTests4, Test_DepthToSpace_3) { sd::ops::depth_to_space op; auto result = op.evaluate({&x}, {}, {4, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } @@ -1066,14 +1066,14 @@ TEST_F(DeclarableOpsTests4, Test_Cross_1) { sd::ops::cross op; auto result = op.evaluate({&a, &b}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -1084,14 +1084,14 @@ TEST_F(DeclarableOpsTests4, Test_Cross_2) { sd::ops::cross op; auto result = op.evaluate({&a, &b}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -1102,14 +1102,14 @@ TEST_F(DeclarableOpsTests4, Test_Cross_3) { sd::ops::cross op; auto result = op.evaluate({&a, &b}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_Add_119) { @@ -1120,16 +1120,16 @@ TEST_F(DeclarableOpsTests4, Test_Add_119) { sd::ops::add op; auto result = op.evaluate({&a, &b}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(2, z->rankOf()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_Reshape_Negative_1) { @@ -1139,14 +1139,14 @@ TEST_F(DeclarableOpsTests4, Test_Reshape_Negative_1) { sd::ops::reshape op; auto result = op.evaluate({&x, &shape}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_TileToShape_1) { @@ -1158,14 +1158,14 @@ TEST_F(DeclarableOpsTests4, Test_TileToShape_1) { sd::ops::tile_to_shape op; auto result = op.evaluate({&x},{}, {2, 4, 3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_StridedSlice_Alex_1) { @@ -1177,14 +1177,14 @@ TEST_F(DeclarableOpsTests4, Test_StridedSlice_Alex_1) { sd::ops::strided_slice op; auto result = op.evaluate({&x}, {}, {0,0,0,1,0, -999,0,0,0, -999,3,4,5, -999,1,1,1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_StridedSlice_Alex_2) { @@ -1199,16 +1199,16 @@ TEST_F(DeclarableOpsTests4, Test_StridedSlice_Alex_2) { sd::ops::strided_slice op; auto result = op.evaluate({&x, &begin, &end, &stride}, {}, {0,0,0,1,0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests4, Test_StridedSlice_Alex_3) { @@ -1224,12 +1224,12 @@ TEST_F(DeclarableOpsTests4, Test_StridedSlice_Alex_3) { sd::ops::strided_slice op; auto result = op.evaluate({&x, &begin, &end, &stride}, {}, {1,0,0,0,0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isEmpty()); - delete result; + } TEST_F(DeclarableOpsTests4, Test_StridedSlice_Alex_4) { auto x = NDArrayFactory::create('c', {1,3}, {1, 2, 3}); @@ -1243,12 +1243,12 @@ TEST_F(DeclarableOpsTests4, Test_StridedSlice_Alex_4) { sd::ops::strided_slice op; auto result = op.evaluate({&x, &begin, &end, &stride}, {}, {1,0,1,0,2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->lengthOf() == 1); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1266,13 +1266,13 @@ TEST_F(DeclarableOpsTests4, parallel_stack_test1) { sd::ops::parallel_stack op; auto results = op.evaluate({&x1, &x2, &x3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1286,14 +1286,14 @@ TEST_F(DeclarableOpsTests4, parallel_stack_test2) { sd::ops::parallel_stack op; auto results = op.evaluate({&x1, &x2, &x3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1307,13 +1307,13 @@ TEST_F(DeclarableOpsTests4, parallel_stack_test3) { sd::ops::parallel_stack op; auto results = op.evaluate({&x1, &x2, &x3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } \ ////////////////////////////////////////////////////////////////////// @@ -1327,13 +1327,13 @@ TEST_F(DeclarableOpsTests4, parallel_stack_test4) { sd::ops::parallel_stack op; auto results = op.evaluate({&x1, &x2, &x3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1347,13 +1347,13 @@ TEST_F(DeclarableOpsTests4, parallel_stack_test5) { sd::ops::parallel_stack op; auto results = op.evaluate({&x1, &x2, &x3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1367,13 +1367,13 @@ TEST_F(DeclarableOpsTests4, parallel_stack_test6) { sd::ops::parallel_stack op; auto results = op.evaluate({&x1, &x2, &x3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1384,13 +1384,13 @@ TEST_F(DeclarableOpsTests4, parallel_stack_test7) { sd::ops::parallel_stack op; auto results = op.evaluate({&x1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1405,13 +1405,13 @@ TEST_F(DeclarableOpsTests4, meshgrid_test1) { sd::ops::meshgrid op; auto results = op.evaluate({&in0, &in1, &in2}, {}, {0}); - auto out0 = results->at(0); - auto out1 = results->at(1); - auto out2 = results->at(2); + auto out0 = results.at(0); + auto out1 = results.at(1); + auto out2 = results.at(2); // out0->printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); ASSERT_TRUE(exp1.isSameShape(out1)); @@ -1419,7 +1419,7 @@ TEST_F(DeclarableOpsTests4, meshgrid_test1) { ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp2.equalsTo(out2)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1434,11 +1434,11 @@ TEST_F(DeclarableOpsTests4, meshgrid_test2) { sd::ops::meshgrid op; auto results = op.evaluate({&in0, &in1, &in2}); - auto out0 = results->at(0); - auto out1 = results->at(1); - auto out2 = results->at(2); + auto out0 = results.at(0); + auto out1 = results.at(1); + auto out2 = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); ASSERT_TRUE(exp1.isSameShape(out1)); @@ -1446,7 +1446,7 @@ TEST_F(DeclarableOpsTests4, meshgrid_test2) { ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp2.equalsTo(out2)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1461,11 +1461,11 @@ TEST_F(DeclarableOpsTests4, meshgrid_test3) { sd::ops::meshgrid op; auto results = op.evaluate({&in0, &in1, &in2}); - auto out0 = results->at(0); - auto out1 = results->at(1); - auto out2 = results->at(2); + auto out0 = results.at(0); + auto out1 = results.at(1); + auto out2 = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); ASSERT_TRUE(exp1.isSameShape(out1)); @@ -1473,7 +1473,7 @@ TEST_F(DeclarableOpsTests4, meshgrid_test3) { ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp2.equalsTo(out2)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1488,11 +1488,11 @@ TEST_F(DeclarableOpsTests4, meshgrid_test4) { sd::ops::meshgrid op; auto results = op.evaluate({&in0, &in1, &in2}, {}, {0}); - auto out0 = results->at(0); - auto out1 = results->at(1); - auto out2 = results->at(2); + auto out0 = results.at(0); + auto out1 = results.at(1); + auto out2 = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); ASSERT_TRUE(exp1.isSameShape(out1)); @@ -1500,7 +1500,7 @@ TEST_F(DeclarableOpsTests4, meshgrid_test4) { ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp2.equalsTo(out2)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1515,11 +1515,11 @@ TEST_F(DeclarableOpsTests4, meshgrid_test5) { sd::ops::meshgrid op; auto results = op.evaluate({&in0, &in1, &in2}, {}, {0}); - auto out0 = results->at(0); - auto out1 = results->at(1); - auto out2 = results->at(2); + auto out0 = results.at(0); + auto out1 = results.at(1); + auto out2 = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); ASSERT_TRUE(exp1.isSameShape(out1)); @@ -1527,7 +1527,7 @@ TEST_F(DeclarableOpsTests4, meshgrid_test5) { ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp2.equalsTo(out2)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1542,11 +1542,11 @@ TEST_F(DeclarableOpsTests4, meshgrid_test6) { sd::ops::meshgrid op; auto results = op.evaluate({&in0, &in1, &in2}, {}, {0}); - auto out0 = results->at(0); - auto out1 = results->at(1); - auto out2 = results->at(2); + auto out0 = results.at(0); + auto out1 = results.at(1); + auto out2 = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); ASSERT_TRUE(exp1.isSameShape(out1)); @@ -1554,7 +1554,7 @@ TEST_F(DeclarableOpsTests4, meshgrid_test6) { ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp2.equalsTo(out2)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1569,11 +1569,11 @@ TEST_F(DeclarableOpsTests4, meshgrid_test7) { sd::ops::meshgrid op; auto results = op.evaluate({&in0, &in1, &in2}, {}, {1}); - auto out0 = results->at(0); - auto out1 = results->at(1); - auto out2 = results->at(2); + auto out0 = results.at(0); + auto out1 = results.at(1); + auto out2 = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); ASSERT_TRUE(exp1.isSameShape(out1)); @@ -1581,7 +1581,7 @@ TEST_F(DeclarableOpsTests4, meshgrid_test7) { ASSERT_TRUE(exp2.isSameShape(out2)); ASSERT_TRUE(exp2.equalsTo(out2)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1592,13 +1592,13 @@ TEST_F(DeclarableOpsTests4, meshgrid_test8) { sd::ops::meshgrid op; auto results = op.evaluate({&in0}, {}, {0}); - auto out0 = results->at(0); + auto out0 = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1609,13 +1609,13 @@ TEST_F(DeclarableOpsTests4, meshgrid_test9) { sd::ops::meshgrid op; auto results = op.evaluate({&in0}, {}, {1}); - auto out0 = results->at(0); + auto out0 = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp0.isSameShape(out0)); ASSERT_TRUE(exp0.equalsTo(out0)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -1636,15 +1636,15 @@ TEST_F(DeclarableOpsTests4, WeightedCrossEntropyWithLogits_1) { sd::ops::weighted_cross_entropy_with_logits op; auto results = op.evaluate({&targets, &input, &weight}); - auto output = results->at(0); + auto output = results.at(0); // output->printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -1658,13 +1658,13 @@ TEST_F(DeclarableOpsTests4, WeightedCrossEntropyWithLogits_2) { sd::ops::weighted_cross_entropy_with_logits op; auto results = op.evaluate({&targets, &input, &weights}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } @@ -1706,10 +1706,10 @@ TEST_F(DeclarableOpsTests4, lstm_test1) { sd::ops::lstm op; auto results = op.evaluate({&x, &h0, &c0, &Wx, &Wh, &Wc, &Wp, &b}, {0., 0., 0.}, {0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto *h = results->at(0); - auto *c = results->at(1); + auto *h = results.at(0); + auto *c = results.at(1); auto cLast = (*c)({4,5,0,0,0,0},true); ASSERT_TRUE(expH.isSameShape(h)); @@ -1718,7 +1718,7 @@ TEST_F(DeclarableOpsTests4, lstm_test1) { ASSERT_TRUE(expClast.isSameShape(&cLast)); ASSERT_TRUE(expClast.equalsTo(&cLast)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1730,14 +1730,14 @@ TEST_F(DeclarableOpsTests4, relu6_test1) { sd::ops::relu6 op; auto results = op.evaluate({&input}, {0.}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } @@ -1752,14 +1752,14 @@ TEST_F(DeclarableOpsTests4, relu6_bp_test1) { sd::ops::relu6_bp op; auto results = op.evaluate({&input, &gradO}, {0.}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -1780,15 +1780,15 @@ TYPED_TEST(TypedDeclarableOpsTests4, LrnTest_1) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {5}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } @@ -1808,15 +1808,15 @@ TYPED_TEST(TypedDeclarableOpsTests4, LrnTest_2) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -1847,15 +1847,15 @@ TYPED_TEST(TypedDeclarableOpsTests4, LrnTest_3) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -1886,15 +1886,15 @@ TYPED_TEST(TypedDeclarableOpsTests4, LrnTest_4) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {5}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -1931,15 +1931,15 @@ TYPED_TEST(TypedDeclarableOpsTests4, LrnTest_5) { sd::ops::lrn_bp op; auto results = op.evaluate({&x, &eps}, {1.0, 1.0, 0.5}, {5}, {}, {}, false); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); // ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } @@ -1953,16 +1953,16 @@ TEST_F(DeclarableOpsTests4, tri_test1) { sd::ops::tri op; auto results = op.evaluate({}, {}, {rows, cols}); - auto output = results->at(0); + auto output = results.at(0); // output->printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1976,14 +1976,14 @@ TEST_F(DeclarableOpsTests4, tri_test2) { sd::ops::tri op; auto results = op.evaluate({}, {}, {rows, cols, diag}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1997,14 +1997,14 @@ TEST_F(DeclarableOpsTests4, tri_test3) { sd::ops::tri op; auto results = op.evaluate({}, {}, {rows, cols, diag}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2018,14 +2018,14 @@ TEST_F(DeclarableOpsTests4, tri_test4) { sd::ops::tri op; auto results = op.evaluate({}, {}, {rows, cols, diag}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2037,14 +2037,14 @@ TEST_F(DeclarableOpsTests4, tri_test5) { sd::ops::tri op; auto results = op.evaluate({}, {}, {rows}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2058,14 +2058,14 @@ TEST_F(DeclarableOpsTests4, tri_test6) { sd::ops::tri op; auto results = op.evaluate({}, {}, {rows, cols, diag}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2079,14 +2079,14 @@ TEST_F(DeclarableOpsTests4, tri_test7) { sd::ops::tri op; auto results = op.evaluate({}, {}, {rows, cols, diag}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2097,15 +2097,15 @@ TEST_F(DeclarableOpsTests4, triu_test1) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2116,14 +2116,14 @@ TEST_F(DeclarableOpsTests4, triu_test2) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {-1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2134,14 +2134,14 @@ TEST_F(DeclarableOpsTests4, triu_test3) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {-1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2152,14 +2152,14 @@ TEST_F(DeclarableOpsTests4, triu_test4) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2170,14 +2170,14 @@ TEST_F(DeclarableOpsTests4, triu_test5) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2188,14 +2188,14 @@ TEST_F(DeclarableOpsTests4, triu_test6) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {10}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2206,14 +2206,14 @@ TEST_F(DeclarableOpsTests4, triu_test7) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {-10}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2224,14 +2224,14 @@ TEST_F(DeclarableOpsTests4, triu_test8) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2242,14 +2242,14 @@ TEST_F(DeclarableOpsTests4, triu_test9) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {-3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2260,14 +2260,14 @@ TEST_F(DeclarableOpsTests4, triu_test10) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2278,14 +2278,14 @@ TEST_F(DeclarableOpsTests4, triu_test11) { sd::ops::triu op; auto results = op.evaluate({&input}, {}, {-58}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } @@ -2300,14 +2300,14 @@ TEST_F(DeclarableOpsTests4, triu_bp_test1) { sd::ops::triu_bp op; auto results = op.evaluate({&input, &gradO}, {}, {1}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(gradI)); ASSERT_TRUE(expected.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2321,14 +2321,14 @@ TEST_F(DeclarableOpsTests4, triu_bp_test2) { sd::ops::triu_bp op; auto results = op.evaluate({&input, &gradO}, {}, {}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(gradI)); ASSERT_TRUE(expected.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2342,14 +2342,14 @@ TEST_F(DeclarableOpsTests4, triu_bp_test3) { sd::ops::triu_bp op; auto results = op.evaluate({&input, &gradO}, {}, {-2}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(gradI)); ASSERT_TRUE(expected.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2363,13 +2363,13 @@ TEST_F(DeclarableOpsTests4, triu_bp_test4) { sd::ops::triu_bp op; auto results = op.evaluate({&input, &gradO}, {}, {10}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(gradI)); ASSERT_TRUE(expected.equalsTo(gradI)); - delete results; + } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests5.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests5.cpp index 37e6238af..8958f9023 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests5.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests5.cpp @@ -47,14 +47,14 @@ TEST_F(DeclarableOpsTests5, Test_PermuteEquality_1) { sd::ops::permute op; auto result = op.evaluate({&x}, {}, {0, 2, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_PermuteEquality_0) { @@ -68,14 +68,14 @@ TEST_F(DeclarableOpsTests5, Test_PermuteEquality_0) { sd::ops::permute op; auto result = op.evaluate({&x}, {}, {0, 1, 2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -90,14 +90,14 @@ TEST_F(DeclarableOpsTests5, Test_PermuteEquality_2) { sd::ops::permute op; auto result = op.evaluate({&x}, {}, {1, 0, 2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_PermuteEquality_3) { @@ -111,14 +111,14 @@ TEST_F(DeclarableOpsTests5, Test_PermuteEquality_3) { sd::ops::permute op; auto result = op.evaluate({&x}, {}, {1, 2, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_PermuteEquality_4) { @@ -132,14 +132,14 @@ TEST_F(DeclarableOpsTests5, Test_PermuteEquality_4) { sd::ops::permute op; auto result = op.evaluate({&x}, {}, {2, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_PermuteEquality_5) { @@ -153,14 +153,14 @@ TEST_F(DeclarableOpsTests5, Test_PermuteEquality_5) { sd::ops::permute op; auto result = op.evaluate({&x}, {}, {2, 1, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_TTS_bp_1) { @@ -174,16 +174,16 @@ TEST_F(DeclarableOpsTests5, Test_TTS_bp_1) { sd::ops::tile_to_shape_bp op; auto result = op.evaluate({&x, &eps}, {}, {2, 4, 3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("RES shape"); // x.printShapeInfo("EXP shape"); // z->printIndexedBuffer("RES output"); ASSERT_TRUE(x.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -195,20 +195,17 @@ TEST_F(DeclarableOpsTests5, Test_Rdiv_bp_1) { sd::ops::reversedivide op_ff; auto result_ff = op_ff.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result_ff->status()); + ASSERT_EQ(Status::OK(), result_ff.status()); - auto z_ff = result_ff->at(0); + auto z_ff = result_ff.at(0); ASSERT_TRUE(eps.isSameShape(z_ff)); sd::ops::reversedivide_bp op_bp; auto result_bp = op_bp.evaluate({&x, &y, &eps}, {}, {}); - ASSERT_EQ(Status::OK(), result_bp->status()); + ASSERT_EQ(Status::OK(), result_bp.status()); - auto z_bp = result_bp->at(0); + auto z_bp = result_bp.at(0); ASSERT_TRUE(x.isSameShape(z_bp)); - - delete result_ff; - delete result_bp; } @@ -218,9 +215,9 @@ TEST_F(DeclarableOpsTests5, Test_Boolean_diff_1) { sd::ops::less op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_EQ(result->at(0)->t(0), true); - delete result; + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_EQ(result.at(0)->t(0), true); + } TEST_F(DeclarableOpsTests5, Test_SetSeed_1) { @@ -230,16 +227,16 @@ TEST_F(DeclarableOpsTests5, Test_SetSeed_1) { sd::ops::set_seed op; auto result = op.evaluate({&x, &y}, {}, {120, 5}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); // result->at(0)->printIndexedBuffer("RES SEED"); + sd::ops::get_seed getOp; auto getRes = getOp.evaluate({}); - ASSERT_EQ(Status::OK(), getRes->status()); -// getRes->at(0)->printIndexedBuffer("Output RES GET SEED"); -// ASSERT_EQ(result->at(0)->t(0), true); - delete result; - delete getRes; + ASSERT_EQ(Status::OK(), getRes.status()); +// getres.at(0)->printIndexedBuffer("Output RES GET SEED"); +// ASSERT_EQ(result.at(0)->t(0), true); } + //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests5, scatterMul_test1) { auto matrix = NDArrayFactory::create('c', {2, 2}, {1.f, 2.f, 3.f, 4.f}); @@ -249,13 +246,13 @@ TEST_F(DeclarableOpsTests5, scatterMul_test1) { sd::ops::scatter_mul op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -267,13 +264,13 @@ TEST_F(DeclarableOpsTests5, scatterDiv_test1) { sd::ops::scatter_div op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Scatter Div"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -285,13 +282,13 @@ TEST_F(DeclarableOpsTests5, scatterSub_test1) { sd::ops::scatter_sub op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Scatter Sub"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -301,12 +298,12 @@ TEST_F(DeclarableOpsTests5, hardsigmoid_test1) { sd::ops::hardsigmoid op; auto result = op.evaluate({&matrix}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -317,12 +314,12 @@ TEST_F(DeclarableOpsTests5, hardsigmoid_test2) { sd::ops::hardsigmoid_bp op; auto result = op.evaluate({&matrix, &eps}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -332,13 +329,13 @@ TEST_F(DeclarableOpsTests5, hardtanh_test1) { sd::ops::hardtanh op; auto result = op.evaluate({&matrix}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Hardtanh 2x2"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests5, hardtanh_test2) { @@ -348,13 +345,13 @@ TEST_F(DeclarableOpsTests5, hardtanh_test2) { sd::ops::hardtanh_bp op; auto result = op.evaluate({&matrix, &eps}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Hardtanh_bp 2x2"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -364,13 +361,13 @@ TEST_F(DeclarableOpsTests5, histogram_test1) { sd::ops::histogram op; auto result = op.evaluate({&matrix}, {}, {3}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Histogram3"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests5, histogram_test2) { @@ -379,12 +376,12 @@ TEST_F(DeclarableOpsTests5, histogram_test2) { sd::ops::histogram op; auto result = op.evaluate({&matrix}, {}, {4}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -394,12 +391,12 @@ TEST_F(DeclarableOpsTests5, Identity_test1) { sd::ops::identity op; auto result = op.evaluate({&matrix}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(matrix.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -409,12 +406,12 @@ TEST_F(DeclarableOpsTests5, Identity_test2) { // auto exp = NDArrayFactory::create('c', {3,3}); sd::ops::identity_bp op; auto result = op.evaluate({&matrix, &eps}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->equalsTo(eps)); - delete result; + } //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests5, Log1p_test1) { @@ -425,12 +422,12 @@ TEST_F(DeclarableOpsTests5, Log1p_test1) { sd::ops::Log1p op; y.applyTransform(sd::transform::Log, y); auto result = op.evaluate({&matrix}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->equalsTo(y)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_SpaceToBatch_1) { @@ -441,14 +438,14 @@ TEST_F(DeclarableOpsTests5, Test_SpaceToBatch_1) { sd::ops::space_to_batch op; auto result = op.evaluate({&x, &paddings}, {}, {2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -459,14 +456,14 @@ TEST_F(DeclarableOpsTests5, Test_SpaceToBatch_2) { sd::ops::space_to_batch op; auto result = op.evaluate({&x, &paddings}, {}, {2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -478,15 +475,15 @@ TEST_F(DeclarableOpsTests5, Test_SpaceToBatch_3) { sd::ops::space_to_batch op; auto result = op.evaluate({&x, &paddings}, {}, {2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -507,15 +504,15 @@ TEST_F(DeclarableOpsTests5, Test_SpaceToBatch_4) { sd::ops::space_to_batch op; auto result = op.evaluate({&x, &paddings}, {}, {blockSize}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_BatchToSpace_1) { @@ -525,15 +522,15 @@ TEST_F(DeclarableOpsTests5, Test_BatchToSpace_1) { sd::ops::batch_to_space op; auto result = op.evaluate({&x, &crops}, {}, {2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_BatchToSpace_2) { @@ -543,14 +540,14 @@ TEST_F(DeclarableOpsTests5, Test_BatchToSpace_2) { sd::ops::batch_to_space op; auto result = op.evaluate({&x, &crops}, {}, {2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -564,14 +561,14 @@ TEST_F(DeclarableOpsTests5, Test_BatchToSpace_3) { sd::ops::batch_to_space op; auto result = op.evaluate({&x, &crops}, {}, {2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -586,14 +583,14 @@ TEST_F(DeclarableOpsTests5, Test_BatchToSpace_4) { sd::ops::batch_to_space op; auto result = op.evaluate({&x, &crops}, {}, {blockSize}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -603,14 +600,14 @@ TEST_F(DeclarableOpsTests5, eye_test1) { sd::ops::eye op; auto results = op.evaluate({}, {}, {-99, 3}); - auto output = results->at(0); + auto output = results.at(0); // output->printIndexedBuffer(); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -620,13 +617,13 @@ TEST_F(DeclarableOpsTests5, eye_test2) { sd::ops::eye op; auto results = op.evaluate({}, {}, {-99, 3, 4}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -636,14 +633,14 @@ TEST_F(DeclarableOpsTests5, eye_test3) { sd::ops::eye op; auto results = op.evaluate({}, {9 /*int*/}, {-99, 3, 4, 2}); - auto output = results->at(0); + auto output = results.at(0); // output->printIndexedBuffer("Output eye"); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -653,13 +650,13 @@ TEST_F(DeclarableOpsTests5, eye_test4) { sd::ops::eye op; auto results = op.evaluate({}, {6/*double*/}, {-99, 3, 4, 2, 2}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -668,10 +665,10 @@ TEST_F(DeclarableOpsTests5, eye_test5) { sd::ops::eye op; auto result = op.evaluate({},{},{3, 2}); - auto z = result->at(0); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + auto z = result.at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -685,13 +682,13 @@ TEST_F(DeclarableOpsTests5, gatherNd_test1) { sd::ops::gather_nd op; auto results = op.evaluate({&input, &indices}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -705,13 +702,13 @@ TEST_F(DeclarableOpsTests5, gatherNd_test2) { sd::ops::gather_nd op; auto results = op.evaluate({&input, &indices}, {}, {}, {true}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -724,13 +721,13 @@ TEST_F(DeclarableOpsTests5, gatherNd_test3) { sd::ops::gather_nd op; auto results = op.evaluate({&input, &indices}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -743,13 +740,13 @@ TEST_F(DeclarableOpsTests5, gatherNd_test4) { sd::ops::gather_nd op; auto results = op.evaluate({&input, &indices}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -761,13 +758,13 @@ TEST_F(DeclarableOpsTests5, gatherNd_test5) { sd::ops::gather_nd op; auto results = op.evaluate({&input, &indices}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -780,13 +777,13 @@ TEST_F(DeclarableOpsTests5, gatherNd_test6) { sd::ops::gather_nd op; auto results = op.evaluate({&input, &indices}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -799,13 +796,13 @@ TEST_F(DeclarableOpsTests5, gatherNd_test7) { sd::ops::gather_nd op; auto results = op.evaluate({&input, &indices}, {}, {}, {true}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -816,13 +813,13 @@ TEST_F(DeclarableOpsTests5, gatherNd_test8) { sd::ops::gather_nd op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; + } TEST_F(DeclarableOpsTests5, gatherNd_test9) { @@ -833,9 +830,9 @@ TEST_F(DeclarableOpsTests5, gatherNd_test9) { sd::ops::gather_nd op; auto result = op.evaluate({&x, &indices}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer(); //z->printShapeInfo("z shape"); @@ -843,7 +840,7 @@ TEST_F(DeclarableOpsTests5, gatherNd_test9) { ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -881,14 +878,14 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test1) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {2, 1}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -901,13 +898,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test2) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {2, 1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -920,13 +917,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test3) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {2, 0}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -939,13 +936,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test4) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {0, 2}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -958,13 +955,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test5) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {1, 2}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -977,13 +974,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test6) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {0, 1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -997,13 +994,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test7) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {1, 0}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1017,13 +1014,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test8) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {0, 1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1037,13 +1034,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test9) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {1, 0}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1057,13 +1054,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test10) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {0, 1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1077,13 +1074,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test11) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {1, 2}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1097,13 +1094,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test12) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {2, 0}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1117,13 +1114,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test13) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &seqLengths}, {}, {3, 0}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1134,13 +1131,13 @@ TEST_F(DeclarableOpsTests5, reverse_sequense_test14) { sd::ops::reverse_sequence op; auto results = op.evaluate({&input, &lengths}, {}, {1, 0}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto z = results->at(0); + auto z = results.at(0); ASSERT_EQ(e, *z); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1152,11 +1149,11 @@ TEST_F(DeclarableOpsTests5, Test_TopK_0) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {1, 0}); // without sorting - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto i = result->at(1); + auto v = result.at(0); + auto i = result.at(1); /* v->printShapeInfo("topK_0: shape v"); expV.printShapeInfo("topK_0: shape expV"); @@ -1179,7 +1176,7 @@ TEST_F(DeclarableOpsTests5, Test_TopK_0) { for (int cases = 0; cases < 100; ++cases) { op.execute({&x}, std::vector{v, i}, {}, {1, 0}, {}); // without sorting } - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1191,11 +1188,11 @@ TEST_F(DeclarableOpsTests5, Test_TopK_1) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {1, 0}); // without sorting - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto i = result->at(1); + auto v = result.at(0); + auto i = result.at(1); // v->printShapeInfo("topK_1: shape v"); // expV.printShapeInfo("topK_1: shape expV"); @@ -1218,7 +1215,7 @@ TEST_F(DeclarableOpsTests5, Test_TopK_1) { for (int cases = 0; cases < 100; ++cases) { op.execute({&x}, std::vector{v, i}, {}, {1, 0}, {}); // without sorting } - delete result; + } /////////////////////////////////////////////////////////// @@ -1244,11 +1241,11 @@ TEST_F(DeclarableOpsTests5, Test_TopK_2) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto i = result->at(1); + auto v = result.at(0); + auto i = result.at(1); // v->printShapeInfo("shape v"); // expV.printShapeInfo("shape expV"); @@ -1267,7 +1264,7 @@ TEST_F(DeclarableOpsTests5, Test_TopK_2) { ASSERT_TRUE(expI.isSameShape(i)); ASSERT_TRUE(expI.equalsTo(i)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_TopK_3) { @@ -1294,11 +1291,11 @@ TEST_F(DeclarableOpsTests5, Test_TopK_3) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {2, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto i = result->at(1); + auto v = result.at(0); + auto i = result.at(1); // v->printShapeInfo("shape v"); // expV.printShapeInfo("shape expV"); @@ -1317,7 +1314,7 @@ TEST_F(DeclarableOpsTests5, Test_TopK_3) { ASSERT_TRUE(expI.isSameShape(i)); ASSERT_TRUE(expI.equalsTo(i)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_TopK_3_unsorted) { @@ -1344,11 +1341,11 @@ TEST_F(DeclarableOpsTests5, Test_TopK_3_unsorted) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {2}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto i = result->at(1); + auto v = result.at(0); + auto i = result.at(1); ASSERT_TRUE(expV.isSameShape(v)); ASSERT_TRUE(expV.equalsTo(v)); @@ -1356,7 +1353,7 @@ TEST_F(DeclarableOpsTests5, Test_TopK_3_unsorted) { ASSERT_TRUE(expI.isSameShape(i)); ASSERT_TRUE(expI.equalsTo(i)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1368,11 +1365,11 @@ TEST_F(DeclarableOpsTests5, Test_TopK_4) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {2, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto i = result->at(1); + auto v = result.at(0); + auto i = result.at(1); ASSERT_TRUE(expV.isSameShape(v)); ASSERT_TRUE(expV.equalsTo(v)); @@ -1380,7 +1377,7 @@ TEST_F(DeclarableOpsTests5, Test_TopK_4) { ASSERT_TRUE(expI.isSameShape(i)); ASSERT_TRUE(expI.equalsTo(i)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1392,11 +1389,11 @@ TEST_F(DeclarableOpsTests5, Test_TopK_5) { sd::ops::top_k op; auto result = op.evaluate({&x}, {}, {2, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto i = result->at(1); + auto v = result.at(0); + auto i = result.at(1); ASSERT_TRUE(expV.isSameShape(v)); ASSERT_TRUE(expV.equalsTo(v)); @@ -1404,7 +1401,7 @@ TEST_F(DeclarableOpsTests5, Test_TopK_5) { ASSERT_TRUE(expI.isSameShape(i)); ASSERT_TRUE(expI.equalsTo(i)); - delete result; + } /////////////////////////////////////////////////////////// @@ -1430,11 +1427,11 @@ TEST_F(DeclarableOpsTests5, Test_Moments_1) { sd::ops::moments op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto d = result->at(1); + auto v = result.at(0); + auto d = result.at(1); // v->printIndexedBuffer("Result is "); // d->printIndexedBuffer("Result is "); @@ -1443,7 +1440,7 @@ TEST_F(DeclarableOpsTests5, Test_Moments_1) { ASSERT_NEAR(expMean, v->e(0), inf); ASSERT_NEAR(expDeviation, d->e(0), inf); - delete result; + } TEST_F(DeclarableOpsTests5, Test_Moments_2) { @@ -1461,11 +1458,11 @@ TEST_F(DeclarableOpsTests5, Test_Moments_2) { sd::ops::moments op; auto result = op.evaluate({&x}, {}, {0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto d = result->at(1); + auto v = result.at(0); + auto d = result.at(1); ASSERT_TRUE(v->isVector()); ASSERT_TRUE(d->isVector()); @@ -1473,7 +1470,7 @@ TEST_F(DeclarableOpsTests5, Test_Moments_2) { ASSERT_TRUE(v->equalsTo(&expV)); ASSERT_TRUE(d->equalsTo(&expD)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_Moments_3) { @@ -1495,11 +1492,11 @@ TEST_F(DeclarableOpsTests5, Test_Moments_3) { sd::ops::moments op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto d = result->at(1); + auto v = result.at(0); + auto d = result.at(1); ASSERT_TRUE(v->isMatrix()); ASSERT_TRUE(d->isMatrix()); @@ -1507,7 +1504,7 @@ TEST_F(DeclarableOpsTests5, Test_Moments_3) { ASSERT_TRUE(v->equalsTo(&expV)); ASSERT_TRUE(d->equalsTo(&expD)); - delete result; + } TEST_F(DeclarableOpsTests5, Test_Moments_4) { @@ -1522,11 +1519,11 @@ TEST_F(DeclarableOpsTests5, Test_Moments_4) { sd::ops::moments op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(2, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(2, result.size()); - auto v = result->at(0); - auto d = result->at(1); + auto v = result.at(0); + auto d = result.at(1); ASSERT_TRUE(v->isMatrix()); ASSERT_TRUE(d->isMatrix()); @@ -1540,7 +1537,7 @@ TEST_F(DeclarableOpsTests5, Test_Moments_4) { ASSERT_TRUE(v->equalsTo(&expV)); ASSERT_TRUE(d->equalsTo(&expD)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1552,16 +1549,16 @@ TEST_F(DeclarableOpsTests5, trace_test1) { NDArray matrix('c', {3, 3}, {1., 2., 3., 4., 5., 6., 7., 8., 9.}); sd::ops::trace op; auto results = op.evaluate({&input}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); double traceM = matrix.getTrace(); // nd4j_printf("Trace for matrix is %f\n", traceM); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); // exp.printIndexedBuffer("EXP TRACE"); // output->printIndexedBuffer("OUT TRACE"); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1573,13 +1570,13 @@ TEST_F(DeclarableOpsTests5, trace_test2) { sd::ops::trace op; auto results = op.evaluate({&input}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1591,13 +1588,13 @@ TEST_F(DeclarableOpsTests5, trace_test3) { sd::ops::trace op; auto results = op.evaluate({&input}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1609,13 +1606,13 @@ TEST_F(DeclarableOpsTests5, trace_test4) { sd::ops::trace op; auto results = op.evaluate({&input}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1627,13 +1624,13 @@ TEST_F(DeclarableOpsTests5, trace_test5) { sd::ops::trace op; auto results = op.evaluate({&input}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1644,19 +1641,19 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test1) { sd::ops::random_shuffle op; auto results = op.evaluate({&input}); - auto output = results->at(0); + auto output = results.at(0); bool haveZeros = false; for(int i = 0; i < output->lengthOf(); ++i) if(output->e(i) == (float)0.) haveZeros = true; - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(input.isSameShape(output)); ASSERT_TRUE(!input.equalsTo(output)); ASSERT_TRUE(!haveZeros); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1667,13 +1664,13 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test2) { sd::ops::random_shuffle op; auto results = op.evaluate({&input}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(input.isSameShape(output)); ASSERT_TRUE(input.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1684,19 +1681,19 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test3) { sd::ops::random_shuffle op; auto results = op.evaluate({&input}); - auto output = results->at(0); + auto output = results.at(0); bool haveZeros = false; for(int i = 0; i < output->lengthOf(); ++i) if(output->e(i) == (float)0.) haveZeros = true; - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(input.isSameShape(output)); ASSERT_TRUE(!input.equalsTo(output)); ASSERT_TRUE(!haveZeros); - delete results; + } ////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests5, random_shuffle_test04) { @@ -1706,8 +1703,8 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test04) { sd::ops::random_shuffle op; //NDArray* output; auto results = op.evaluate({&input}, {}, {}, {}, {}, true); - ASSERT_EQ(Status::OK(), results->status()); - auto output = &input; //results->at(0); + ASSERT_EQ(Status::OK(), results.status()); + auto output = &input; //results.at(0); bool haveZeros = false; for(int i = 0; i < output->lengthOf(); ++i) if(output->e(i) == (float)0.) @@ -1717,7 +1714,7 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test04) { //ASSERT_TRUE(!input.equalsTo(output)); ASSERT_TRUE(!haveZeros); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1728,8 +1725,8 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test4) { sd::ops::random_shuffle op; //NDArray* output; auto results = op.evaluate({&input}); - ASSERT_EQ(Status::OK(), results->status()); - auto output = results->at(0); + ASSERT_EQ(Status::OK(), results.status()); + auto output = results.at(0); bool haveZeros = false; for(int i = 0; i < output->lengthOf(); ++i) if(output->e(i) == (float)0.) @@ -1739,7 +1736,7 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test4) { //ASSERT_TRUE(!input.equalsTo(output)); ASSERT_TRUE(!haveZeros); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1750,19 +1747,19 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test5) { sd::ops::random_shuffle op; auto results = op.evaluate({&input}); - auto output = results->at(0); + auto output = results.at(0); bool haveZeros = false; for(int i = 0; i < output->lengthOf(); ++i) if(output->e(i) == (float)0.) haveZeros = true; - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(input.isSameShape(output)); ASSERT_TRUE(!input.equalsTo(output)); ASSERT_TRUE(!haveZeros); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1773,19 +1770,19 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test6) { sd::ops::random_shuffle op; auto results = op.evaluate({&input}); - auto output = results->at(0); + auto output = results.at(0); bool haveZeros = false; for(int i = 0; i < output->lengthOf(); ++i) if(output->e(i) == (float)0.) haveZeros = true; - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(input.isSameShape(output)); ASSERT_TRUE(!input.equalsTo(output)); ASSERT_TRUE(!haveZeros); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1797,13 +1794,13 @@ TEST_F(DeclarableOpsTests5, random_shuffle_test7) { sd::ops::random_shuffle op; auto results = op.evaluate({&input}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(input.isSameShape(output)); ASSERT_TRUE(input.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////////////////////////// @@ -1827,18 +1824,18 @@ TEST_F(DeclarableOpsTests5, EmbeddingLookup_1) { sd::ops::embedding_lookup op; auto result = op.evaluate({&x, &y}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); // x.printShapeInfo("Input"); output->printShapeInfo("Output"); exp.printShapeInfo("Expected"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); //output->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expect"); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests5, EmbeddingLookup_2) { @@ -1863,18 +1860,18 @@ TEST_F(DeclarableOpsTests5, EmbeddingLookup_2) { sd::ops::embedding_lookup op; auto result = op.evaluate({&x, &y}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); // x.printShapeInfo("Input"); // output->printShapeInfo("Output"); // exp.printShapeInfo("Expected"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); // output->printIndexedBuffer("Output"); // exp.printIndexedBuffer("Expect"); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests5, EmbeddingLookup_3) { @@ -1904,18 +1901,18 @@ TEST_F(DeclarableOpsTests5, EmbeddingLookup_3) { sd::ops::embedding_lookup op; auto result = op.evaluate({&p1, &p2, &p3, &p4, &p5, &p6, &p7, &p8, &y}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); // x.printShapeInfo("Input"); // output->printIndexedBuffer("Output"); // exp.printShapeInfo("Expected"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); // output->printIndexedBuffer("Output"); // exp.printIndexedBuffer("Expect"); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } /* @Test public void testDynamicPartition(){ @@ -1948,18 +1945,18 @@ TEST_F(DeclarableOpsTests5, DynamicPartition_01) { sd::ops::dynamic_partition op; auto result = op.evaluate({&x, &y}, {}, {numPartition}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(result->size(), numPartition); // result has the same size as given param 4 + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(result.size(), numPartition); // result has the same size as given param 4 - for (int e = 0; e < result->size(); e++) { - auto output = result->at(e); + for (int e = 0; e < result.size(); e++) { + auto output = result.at(e); // output->printShapeInfo("Output shape> "); // output->printIndexedBuffer("Output data> "); ASSERT_TRUE(exp[e].isSameShape(output)); ASSERT_TRUE(exp[e].equalsTo(output)); } - delete result; + } TEST_F(DeclarableOpsTests5, DynamicPartition_1) { @@ -1987,18 +1984,18 @@ TEST_F(DeclarableOpsTests5, DynamicPartition_1) { sd::ops::dynamic_partition op; auto result = op.evaluate({&x, &y}, {}, {numPartition}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(result->size(), numPartition); // result has the same size as given param 4 + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(result.size(), numPartition); // result has the same size as given param 4 - for (int e = 0; e < result->size(); e++) { - auto output = result->at(e); + for (int e = 0; e < result.size(); e++) { + auto output = result.at(e); // output->printShapeInfo("Output shape> "); // output->printIndexedBuffer("Output data> "); ASSERT_TRUE(exp[e].isSameShape(output)); ASSERT_TRUE(exp[e].equalsTo(output)); } - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2017,17 +2014,17 @@ TEST_F(DeclarableOpsTests5, DynamicPartition_2) { int numPartition = 4; auto result = op.evaluate({&x, &y}, {}, {numPartition}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(result->size(), numPartition); // result has the same size as given param 4 + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(result.size(), numPartition); // result has the same size as given param 4 - for (int e = 0; e < result->size(); e++) { - auto output = result->at(e); + for (int e = 0; e < result.size(); e++) { + auto output = result.at(e); ASSERT_TRUE(exp[e].isSameShape(output)); ASSERT_TRUE(exp[e].equalsTo(output)); } - delete result; + } @@ -2045,11 +2042,11 @@ TEST_F(DeclarableOpsTests5, DynamicPartition_3) { int numPartition = 4; auto result = op.evaluate({&x, &y}, {}, {numPartition}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(result->size(), numPartition); // result has the same size as given param 4 + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(result.size(), numPartition); // result has the same size as given param 4 - for (int e = 0; e < result->size(); e++) { - auto output = result->at(e); + for (int e = 0; e < result.size(); e++) { + auto output = result.at(e); if (output) { // output->printShapeInfo("Output shape> "); @@ -2065,7 +2062,7 @@ TEST_F(DeclarableOpsTests5, DynamicPartition_3) { } } - delete result; + } TEST_F(DeclarableOpsTests5, DynamicStitch_empty_1) { @@ -2079,9 +2076,9 @@ TEST_F(DeclarableOpsTests5, DynamicStitch_empty_1) { sd::ops::dynamic_stitch op; auto result = op.evaluate({&i0, &i1, &i2, &d0, &d1, &d2}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; + } TEST_F(DeclarableOpsTests5, DynamicStitch_empty_2) { @@ -2095,9 +2092,9 @@ TEST_F(DeclarableOpsTests5, DynamicStitch_empty_2) { sd::ops::dynamic_stitch op; auto result = op.evaluate({&i0, &i1, &i2, &d0, &d1, &d2}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2115,14 +2112,14 @@ TEST_F(DeclarableOpsTests5, DynamicStitch_1) { sd::ops::dynamic_stitch op; auto result = op.evaluate({&x1, &x2, &y1, &y2}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2140,9 +2137,9 @@ TEST_F(DeclarableOpsTests5, DynamicStitch_2) { sd::ops::dynamic_stitch op; auto result = op.evaluate({&x1, &x2, &y1, &y2}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = result->at(0); + auto output = result.at(0); // output->printShapeInfo("Output shape> "); // exp.printShapeInfo("Expected shape> "); @@ -2151,7 +2148,7 @@ TEST_F(DeclarableOpsTests5, DynamicStitch_2) { ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -2171,16 +2168,16 @@ TEST_F(DeclarableOpsTests5, fusedBatchNorm_test1) { sd::ops::fused_batch_norm op; auto results = op.evaluate({&x, &scale, &offset}, {}, {0,1}); - auto y = results->at(0); - auto batchMean = results->at(1); - auto batchVar = results->at(2); + auto y = results.at(0); + auto batchMean = results.at(1); + auto batchVar = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expY.isSameShape(y)); ASSERT_TRUE(expBatchMean.isSameShape(batchMean)); ASSERT_TRUE(expBatchVar.isSameShape(batchVar)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2200,16 +2197,16 @@ TEST_F(DeclarableOpsTests5, fusedBatchNorm_test2) { sd::ops::fused_batch_norm op; auto results = op.evaluate({&x, &scale, &offset}, {0.05}, {0,1}); - auto y = results->at(0); - auto batchMean = results->at(1); - auto batchVar = results->at(2); + auto y = results.at(0); + auto batchMean = results.at(1); + auto batchVar = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expY.isSameShape(y)); ASSERT_TRUE(expBatchMean.isSameShape(batchMean)); ASSERT_TRUE(expBatchVar.isSameShape(batchVar)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2229,16 +2226,16 @@ TEST_F(DeclarableOpsTests5, fusedBatchNorm_test3) { sd::ops::fused_batch_norm op; auto results = op.evaluate({&x, &scale, &offset}, {}, {1,1}); - auto y = results->at(0); - auto batchMean = results->at(1); - auto batchVar = results->at(2); + auto y = results.at(0); + auto batchMean = results.at(1); + auto batchVar = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expY.isSameShape(y)); ASSERT_TRUE(expBatchMean.isSameShape(batchMean)); ASSERT_TRUE(expBatchVar.isSameShape(batchVar)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2264,16 +2261,16 @@ TEST_F(DeclarableOpsTests5, fusedBatchNorm_test4) { sd::ops::fused_batch_norm op; auto results = op.evaluate({&x, &scale, &offset}, {}, {0,1}); - auto y = results->at(0); - auto batchMean = results->at(1); - auto batchVar = results->at(2); + auto y = results.at(0); + auto batchMean = results.at(1); + auto batchVar = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expY.isSameShape(y)); ASSERT_TRUE(expBatchMean.isSameShape(batchMean)); ASSERT_TRUE(expBatchVar.isSameShape(batchVar)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2299,16 +2296,16 @@ TEST_F(DeclarableOpsTests5, fusedBatchNorm_test5) { sd::ops::fused_batch_norm op; auto results = op.evaluate({&x, &scale, &offset}, {0.05}, {0,1}); - auto y = results->at(0); - auto batchMean = results->at(1); - auto batchVar = results->at(2); + auto y = results.at(0); + auto batchMean = results.at(1); + auto batchVar = results.at(2); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expY.isSameShape(y)); ASSERT_TRUE(expBatchMean.isSameShape(batchMean)); ASSERT_TRUE(expBatchVar.isSameShape(batchVar)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2320,14 +2317,14 @@ TEST_F(DeclarableOpsTests5, confusion_matrix_test1) { sd::ops::confusion_matrix op; auto results = op.evaluate({&labels, &predictions}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2339,14 +2336,14 @@ TEST_F(DeclarableOpsTests5, confusion_matrix_test2) { sd::ops::confusion_matrix op; auto results = op.evaluate({&labels, &predictions}, {}, {3}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2359,13 +2356,13 @@ TEST_F(DeclarableOpsTests5, confusion_matrix_test3) { sd::ops::confusion_matrix op; auto results = op.evaluate({&labels, &predictions, &weights}, {}, {3}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2378,13 +2375,14 @@ TEST_F(DeclarableOpsTests5, confusion_matrix_test4) { sd::ops::confusion_matrix op; auto results = op.evaluate({&labels, &predictions, &weights}, {}, {3, sd::DataType::DOUBLE}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////////////////// @@ -2398,11 +2396,11 @@ TEST_F(DeclarableOpsTests5, ZeroFraction_1) { sd::ops::zero_fraction op; auto res = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), res->status()); - ASSERT_TRUE(res->at(0)->isScalar()); - ASSERT_EQ(res->at(0)->e(0), 0.25); + ASSERT_EQ(Status::OK(), res.status()); + ASSERT_TRUE(res.at(0)->isScalar()); + ASSERT_EQ(res.at(0)->e(0), 0.25); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2413,11 +2411,11 @@ TEST_F(DeclarableOpsTests5, ZeroFraction_2) { sd::ops::zero_fraction op; auto res = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), res->status()); - ASSERT_TRUE(res->at(0)->isScalar()); - ASSERT_EQ(res->at(0)->e(0), 0.375); + ASSERT_EQ(Status::OK(), res.status()); + ASSERT_TRUE(res.at(0)->isScalar()); + ASSERT_EQ(res.at(0)->e(0), 0.375); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2428,11 +2426,11 @@ TEST_F(DeclarableOpsTests5, ZeroFraction_3) { sd::ops::zero_fraction op; auto res = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), res->status()); - ASSERT_TRUE(res->at(0)->isScalar()); - ASSERT_EQ(res->at(0)->e(0), 0.375); + ASSERT_EQ(Status::OK(), res.status()); + ASSERT_TRUE(res.at(0)->isScalar()); + ASSERT_EQ(res.at(0)->e(0), 0.375); - delete res; + } //////////////////////////////////////////////////////////////////////////////// @@ -2447,14 +2445,14 @@ TEST_F(DeclarableOpsTests5, XWPlusB_1) { sd::ops::xw_plus_b op; auto result = op.evaluate({&x, &y, &b}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2465,9 +2463,9 @@ TEST_F(DeclarableOpsTests5, StopGradient_1) { sd::ops::stop_gradient op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = result->at(0); + auto output = result.at(0); // output->printShapeInfo("Output shape> "); // x.printShapeInfo("Expected shape> "); @@ -2477,7 +2475,7 @@ TEST_F(DeclarableOpsTests5, StopGradient_1) { ASSERT_TRUE(x.isSameShape(output)); ASSERT_TRUE(x.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2488,9 +2486,9 @@ TEST_F(DeclarableOpsTests5, StopGradient_2) { sd::ops::stop_gradient op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto output = result->at(0); + auto output = result.at(0); // output->printShapeInfo("Output shape> "); // x.printShapeInfo("Expected shape> "); @@ -2500,7 +2498,7 @@ TEST_F(DeclarableOpsTests5, StopGradient_2) { ASSERT_TRUE(x.isSameShape(output)); ASSERT_TRUE(x.equalsTo(output)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -2511,13 +2509,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test1) { sd::ops::log_softmax op; auto results = op.evaluate({&input}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2528,13 +2526,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test2) { sd::ops::log_softmax op; auto results = op.evaluate({&input}, {}, {1}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2545,13 +2543,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test3) { sd::ops::log_softmax op; auto results = op.evaluate({&input}, {}, {2}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } @@ -2563,13 +2561,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test5) { sd::ops::log_softmax op; auto results = op.evaluate({&input}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2580,13 +2578,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test6) { sd::ops::log_softmax op; auto results = op.evaluate({&input}, {}, {0}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2597,13 +2595,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test7) { sd::ops::log_softmax op; auto results = op.evaluate({&input}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2614,13 +2612,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test8) { sd::ops::log_softmax op; auto results = op.evaluate({&input}, {}, {0}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2631,13 +2629,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test9) { sd::ops::log_softmax op; auto results = op.evaluate({&input}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2648,13 +2646,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test10) { sd::ops::log_softmax op; auto results = op.evaluate({&input}, {}, {0}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2665,13 +2663,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test11) { sd::ops::log_softmax op; auto results = op.evaluate({&input}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2684,13 +2682,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_test12) { { sd::ops::log_softmax op; auto results = op.evaluate({&input}); - auto z = results->at(0); + auto z = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOutput.isSameShape(z)); ASSERT_TRUE(expOutput.equalsTo(z, 1e-4)); - delete results; + } } @@ -2703,13 +2701,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_bp_test1) { sd::ops::log_softmax_bp op; auto results = op.evaluate({&input, &epsilon}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2721,13 +2719,13 @@ TEST_F(DeclarableOpsTests5, log_softmax_bp_test2) { sd::ops::log_softmax_bp op; auto results = op.evaluate({&input, &epsilon}, {}, {0}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -2750,14 +2748,14 @@ TEST_F(DeclarableOpsTests5, L2_Loss_1) { sd::ops::l2_loss op; auto results = op.evaluate({&input}, {}, {}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(output->isScalar()); ASSERT_EQ(output->e(0), exp); - delete results; + } TEST_F(DeclarableOpsTests5, L2_Loss_2) { @@ -2766,13 +2764,13 @@ TEST_F(DeclarableOpsTests5, L2_Loss_2) { sd::ops::l2_loss op; auto results = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto z = results->at(0); + auto z = results.at(0); ASSERT_EQ(e, *z); - delete results; + } TEST_F(DeclarableOpsTests5, L2_Loss_3) { @@ -2798,13 +2796,13 @@ TEST_F(DeclarableOpsTests5, LogPoissonLoss_1) { sd::ops::log_poisson_loss op; auto results = op.evaluate({&input, &weights, &targets}, {}, {0}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -2819,13 +2817,13 @@ TEST_F(DeclarableOpsTests5, LogPoissonLoss_2) { sd::ops::log_poisson_loss op; auto results = op.evaluate({&input, &weights, &targets}, {}, {0, 1}); - auto output = results->at(0); + auto output = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -2866,18 +2864,18 @@ TEST_F(DeclarableOpsTests5, NormalizeMoments_1) { sd::ops::normalize_moments op; auto results = op.evaluate({&counts, &means, &deviance}, {0.0}, {}); - ASSERT_EQ(Status::OK(), results->status()); - ASSERT_EQ(results->size(), 2); + ASSERT_EQ(Status::OK(), results.status()); + ASSERT_EQ(results.size(), 2); - auto outputMeans = results->at(0); - auto outputDeviance = results->at(1); + auto outputMeans = results.at(0); + auto outputDeviance = results.at(1); ASSERT_TRUE(expMeans.isSameShape(outputMeans)); ASSERT_TRUE(expMeans.equalsTo(outputMeans)); ASSERT_TRUE(expMeans.isSameShape(outputDeviance)); ASSERT_TRUE(expDeviance.equalsTo(outputDeviance)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -2917,18 +2915,18 @@ TEST_F(DeclarableOpsTests5, NormalizeMoments_2) { sd::ops::normalize_moments op; auto results = op.evaluate({&counts, &means, &deviance}, {0.0}, {}); - ASSERT_EQ(Status::OK(), results->status()); - ASSERT_EQ(results->size(), 2); + ASSERT_EQ(Status::OK(), results.status()); + ASSERT_EQ(results.size(), 2); - auto outputMeans = results->at(0); - auto outputDeviance = results->at(1); + auto outputMeans = results.at(0); + auto outputDeviance = results.at(1); ASSERT_TRUE(expMeans.isSameShape(outputMeans)); ASSERT_TRUE(expMeans.equalsTo(outputMeans)); ASSERT_TRUE(expMeans.isSameShape(outputDeviance)); ASSERT_TRUE(expDeviance.equalsTo(outputDeviance)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -2968,17 +2966,17 @@ TEST_F(DeclarableOpsTests5, NormalizeMoments_3) { sd::ops::normalize_moments op; auto results = op.evaluate({&counts, &means, &deviance}, {shift}, {}); - ASSERT_EQ(Status::OK(), results->status()); - ASSERT_EQ(results->size(), 2); + ASSERT_EQ(Status::OK(), results.status()); + ASSERT_EQ(results.size(), 2); - auto outputMeans = results->at(0); - auto outputDeviance = results->at(1); + auto outputMeans = results.at(0); + auto outputDeviance = results.at(1); ASSERT_TRUE(expMeans.isSameShape(outputMeans)); ASSERT_TRUE(expMeans.equalsTo(outputMeans)); ASSERT_TRUE(expMeans.isSameShape(outputDeviance)); ASSERT_TRUE(expDeviance.equalsTo(outputDeviance)); - delete results; + } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests6.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests6.cpp index 6eee59058..002e3376f 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests6.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests6.cpp @@ -7,7 +7,7 @@ * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * WARRANTIES OR CONDITIONS OF ANY KIND, either expres or implied. See the * License for the specific language governing permissions and limitations * under the License. * @@ -51,13 +51,13 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_1) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_2) { @@ -72,13 +72,13 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_2) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(exp, *z); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_3) { @@ -93,14 +93,14 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_3) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printShapeInfo("SS OS shape"); ASSERT_TRUE(z->isEmpty()); //ASSERT_EQ(exp, *z); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_4) { @@ -115,14 +115,14 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_4) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->equalsTo(exp)); //ASSERT_EQ(exp, *z); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_04) { @@ -135,9 +135,9 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_04) { //auto exp = NDArrayFactory::create('c', {2}, {1.0f, 2.0f}); auto onesRes = opOnes.evaluate({&matrix}); //matrix.linspace(1); - ASSERT_EQ(onesRes->status(), Status::OK()); + ASSERT_EQ(onesRes.status(), Status::OK()); - auto ones = onesRes->at(0); + auto ones = onesRes.at(0); *ones *= 10; auto onesD = new NDArray(ones->dup()); @@ -163,8 +163,6 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_04) { ASSERT_TRUE(shape::isEmpty(result->at(0))); //ASSERT_EQ(exp, *z); delete block; - - delete onesRes; delete result; delete variableSpace; delete inputShapes; @@ -182,12 +180,12 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_5) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_6) { @@ -202,12 +200,12 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_6) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {0, 0, 0, 0, 2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_7) { @@ -223,12 +221,12 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_Once_Again_7) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &b, &e, &s}, {}, {1, 0, 0, 0, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); //ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_BP_1) { @@ -245,12 +243,12 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_BP_1) { sd::ops::strided_slice_bp op; auto result = op.evaluate({&matrix, &grad}, {}, {1, 0, 1, 0, 2, 0, 0, 0, 1, 1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); //ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_BP_2) { @@ -267,12 +265,12 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_BP_2) { sd::ops::strided_slice_bp op; auto result = op.evaluate({&matrix, &grad}, {}, {1, 0, 1, 0, 2, 0, 0, 0, 1, 1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); //ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_StridedSlice_BP_3) { @@ -289,12 +287,12 @@ TEST_F(DeclarableOpsTests6, Test_StridedSlice_BP_3) { sd::ops::strided_slice_bp op; auto result = op.evaluate({&matrix, &grad}, {}, {1, 0, 1, 0, 0, 0, 0, 0, 256, 1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); //ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_Simple_Scalar_1) { @@ -304,14 +302,14 @@ TEST_F(DeclarableOpsTests6, Test_Simple_Scalar_1) { sd::ops::test_scalar op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_Order_1) { @@ -322,13 +320,13 @@ TEST_F(DeclarableOpsTests6, Test_Order_1) { sd::ops::order op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); ASSERT_NE(x.ordering(), z->ordering()); - delete result; + } TEST_F(DeclarableOpsTests6, cumSum_1) { @@ -337,14 +335,14 @@ TEST_F(DeclarableOpsTests6, cumSum_1) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, cumSum_2) { @@ -353,15 +351,15 @@ TEST_F(DeclarableOpsTests6, cumSum_2) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("CumSum1"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, cumSum_3) { @@ -370,14 +368,14 @@ TEST_F(DeclarableOpsTests6, cumSum_3) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 0, 0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, cumSum_4) { @@ -386,14 +384,14 @@ TEST_F(DeclarableOpsTests6, cumSum_4) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 1, 0}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, cumSum_5) { @@ -402,13 +400,13 @@ TEST_F(DeclarableOpsTests6, cumSum_5) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 1, 1}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, cumSum_6) { @@ -417,13 +415,13 @@ TEST_F(DeclarableOpsTests6, cumSum_6) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {1, 1, 0}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, cumSum_7) { @@ -432,13 +430,13 @@ TEST_F(DeclarableOpsTests6, cumSum_7) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {1, 1, 1}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, cumSum_8) { @@ -448,13 +446,13 @@ TEST_F(DeclarableOpsTests6, cumSum_8) { sd::ops::cumsum op; auto result = op.evaluate({&x, &axis}, {}, {1, 1}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -476,37 +474,37 @@ TEST_F(DeclarableOpsTests6, cumSum_9) { sd::ops::cumsum op; auto result = op.evaluate({&inputC, &axis}, {}, {exclusive, reverse}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); ASSERT_TRUE(expFF.equalsTo(z)); - delete result; + //************************************// exclusive = 1; reverse = 0; result = op.evaluate({&inputC, &axis}, {}, {exclusive, reverse}); - ASSERT_EQ(Status::OK(), result->status()); - z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + z = result.at(0); ASSERT_TRUE(expTF.equalsTo(z)); - delete result; + //************************************// exclusive = 0; reverse = 1; result = op.evaluate({&inputC, &axis}, {}, {exclusive, reverse}); - ASSERT_EQ(Status::OK(), result->status()); - z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + z = result.at(0); ASSERT_TRUE(expFT.equalsTo(z)); - delete result; + //************************************// exclusive = 1; reverse = 1; result = op.evaluate({&inputC, &axis}, {}, {exclusive, reverse}); - ASSERT_EQ(Status::OK(), result->status()); - z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + z = result.at(0); ASSERT_TRUE(expTT.equalsTo(z)); - delete result; + } @@ -517,9 +515,9 @@ TEST_F(DeclarableOpsTests6, cumSum_10) { sd::ops::cumsum op; auto result = op.evaluate({&x, &y}, {}, {1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -532,13 +530,13 @@ TEST_F(DeclarableOpsTests6, cumSum_11) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -551,13 +549,13 @@ TEST_F(DeclarableOpsTests6, cumSum_12) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -570,13 +568,13 @@ TEST_F(DeclarableOpsTests6, cumSum_13) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {1, 1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -589,13 +587,13 @@ TEST_F(DeclarableOpsTests6, cumSum_14) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {1, 1, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -608,13 +606,13 @@ TEST_F(DeclarableOpsTests6, cumSum_15) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 1, 2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -624,16 +622,16 @@ TEST_F(DeclarableOpsTests6, cumSum_16) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo(); // x.printShapeInfo(); ASSERT_TRUE(z->ews() == 1); ASSERT_TRUE(x.ews() == 1); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -660,13 +658,13 @@ TEST_F(DeclarableOpsTests6, cumSum_17) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -693,13 +691,13 @@ TEST_F(DeclarableOpsTests6, cumSum_18) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {1, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -726,14 +724,14 @@ TEST_F(DeclarableOpsTests6, cumSum_19) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {0, 1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // exp0.printBuffer(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -760,13 +758,13 @@ TEST_F(DeclarableOpsTests6, cumSum_20) { sd::ops::cumsum op; auto result = op.evaluate({&x}, {}, {1, 1, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -778,14 +776,14 @@ TEST_F(DeclarableOpsTests6, TestMergeMaxIndex_1) { auto exp = NDArrayFactory::create('c', {2, 2, 2}, {1, 2, 1, 2, 1, 2, 1, 2}); sd::ops::mergemaxindex op; - auto ress = op.evaluate({&x, &y, &z}, {}, {}, {}); + auto res = op.evaluate({&x, &y, &z}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); -// ress->at(0)->printIndexedBuffer("MergeMaxIndex Result is "); -// ress->at(0)->printShapeInfo("Shape info for MergeMaxIdex"); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); +// res.at(0)->printIndexedBuffer("MergeMaxIndex Result is "); +// res.at(0)->printShapeInfo("Shape info for MergeMaxIdex"); // x.printIndexedBuffer("Input is"); - ASSERT_TRUE(ress->at(0)->equalsTo(exp)); - delete ress; + ASSERT_TRUE(res.at(0)->equalsTo(exp)); + } //////////////////////////////////////////////////////////////////////////////// @@ -799,12 +797,12 @@ TEST_F(DeclarableOpsTests6, TestMergeMaxIndex_2) { auto ress = op.evaluate({&x, &y, &z}, {}, {sd::DataType::INT64}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); -// ress->at(0)->printIndexedBuffer("MergeMaxIndex2 Result is "); -// ress->at(0)->printShapeInfo("Shape info for MergeMaxIdex2"); + ASSERT_EQ(ND4J_STATUS_OK, ress.status()); +// res.at(0)->printIndexedBuffer("MergeMaxIndex2 Result is "); +// res.at(0)->printShapeInfo("Shape info for MergeMaxIdex2"); // x.printIndexedBuffer("Input is"); - ASSERT_TRUE(ress->at(0)->equalsTo(exp)); - delete ress; + ASSERT_TRUE(ress.at(0)->equalsTo(exp)); + } //////////////////////////////////////////////////////////////////////////////// @@ -814,13 +812,13 @@ TEST_F(DeclarableOpsTests6, TestDropout_1) { auto shape = NDArrayFactory::create({2, 2}); sd::ops::dropout op; - auto ress = op.evaluate({&x, &shape}, {0.2f}, {113}); + auto res = op.evaluate({&x, &shape}, {0.2f}, {113}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); - //ress->at(0)->printIndexedBuffer("Result is "); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + //res.at(0)->printIndexedBuffer("Result is "); //x.printIndexedBuffer("Input is"); - delete ress; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests6, TestMod_1) { @@ -830,13 +828,13 @@ TEST_F(DeclarableOpsTests6, TestMod_1) { auto exp = NDArrayFactory::create('c', {2, 2, 2}, {1, 0, 3, 0, 5, 0, 7, 0}); sd::ops::mod op; - auto ress = op.evaluate({&x, &y}); + auto res = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); -// ress->at(0)->printIndexedBuffer("MOD Result is "); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); +// res.at(0)->printIndexedBuffer("MOD Result is "); // x.printIndexedBuffer("Input is"); - ASSERT_TRUE(ress->at(0)->equalsTo(exp)); - delete ress; + ASSERT_TRUE(res.at(0)->equalsTo(exp)); + } //////////////////////////////////////////////////////////////////////////////// @@ -848,14 +846,14 @@ TEST_F(DeclarableOpsTests6, TestMod_BP_1) { auto exp = NDArrayFactory::create('c', {2, 2, 2}); sd::ops::mod_bp op; - auto ress = op.evaluate({&x, &y, &eps}); + auto res = op.evaluate({&x, &y, &eps}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); -// ress->at(0)->printIndexedBuffer("MOD_BP Result is "); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); +// res.at(0)->printIndexedBuffer("MOD_BP Result is "); // x.printIndexedBuffer("Input is"); - ASSERT_TRUE(ress->at(0)->equalsTo(exp)); - delete ress; + ASSERT_TRUE(res.at(0)->equalsTo(exp)); + } /////////////////////////////////////////////////////////////////////////////// @@ -867,12 +865,12 @@ TEST_F(DeclarableOpsTests6, TestRank_1) { auto exp = NDArrayFactory::create(3); sd::ops::rank op; - auto ress = op.evaluate({&x}); + auto res = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); - ASSERT_TRUE(ress->at(0)->equalsTo(exp)); - delete ress; + ASSERT_TRUE(res.at(0)->equalsTo(exp)); + } TEST_F(DeclarableOpsTests6, TestDropout_2) { // auto x0 = NDArrayFactory::create('c', {10, 10}); @@ -881,11 +879,11 @@ TEST_F(DeclarableOpsTests6, TestDropout_2) { sd::ops::dropout op; - auto ress = op.evaluate({&x}, {0.4f}, {113}); + auto res = op.evaluate({&x}, {0.4f}, {113}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); - delete ress; + } TEST_F(DeclarableOpsTests6, TestDropout_3) { @@ -896,11 +894,11 @@ TEST_F(DeclarableOpsTests6, TestDropout_3) { sd::ops::dropout op; - auto ress = op.evaluate({&x, &shape}, {0.4f}, {113}); + auto res = op.evaluate({&x, &shape}, {0.4f}, {113}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); - delete ress; + } //////////////////////////////////////////////////////////////////////////////// @@ -913,18 +911,18 @@ TEST_F(DeclarableOpsTests6, MaxPoolWithArgmax_1) { sd::ops::max_pool_with_argmax op; - auto ress = op.evaluate({&x}, {}, {1,1,1,1,1,1,1,1,1}); + auto res = op.evaluate({&x}, {}, {1,1,1,1,1,1,1,1,1}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); - ASSERT_TRUE(expI.isSameShape(ress->at(0))); - ASSERT_TRUE(expI.isSameShape(ress->at(1))); - ASSERT_TRUE(x.equalsTo(ress->at(0))); - ASSERT_TRUE(expI.equalsTo(ress->at(1))); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(expI.isSameShape(res.at(0))); + ASSERT_TRUE(expI.isSameShape(res.at(1))); + ASSERT_TRUE(x.equalsTo(res.at(0))); + ASSERT_TRUE(expI.equalsTo(res.at(1))); //x.printIndexedBuffer("Input is"); - ASSERT_TRUE(expI.equalsTo(ress->at(1))); + ASSERT_TRUE(expI.equalsTo(res.at(1))); - delete ress; + } //////////////////////////////////////////////////////////////////////////////// @@ -942,14 +940,14 @@ TEST_F(DeclarableOpsTests6, SufficientStatistics_1) { sd::ops::sufficient_statistics op; - auto ress = op.evaluate({&x, &axis}); + auto res = op.evaluate({&x, &axis}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); - ASSERT_EQ(ress->at(0)->e(0), count); - ASSERT_TRUE(sumExp.equalsTo(ress->at(1))); - ASSERT_TRUE(sqrExp.equalsTo(ress->at(2))); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_EQ(res.at(0)->e(0), count); + ASSERT_TRUE(sumExp.equalsTo(res.at(1))); + ASSERT_TRUE(sqrExp.equalsTo(res.at(2))); - delete ress; + } //////////////////////////////////////////////////////////////////////////////// @@ -974,14 +972,14 @@ TEST_F(DeclarableOpsTests6, SufficientStatistics_2) { sd::ops::sufficient_statistics op; - auto ress = op.evaluate({&x, &axis}); + auto res = op.evaluate({&x, &axis}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); - ASSERT_EQ(ress->at(0)->e(0), count); - ASSERT_TRUE(sumExp.equalsTo(ress->at(1))); - ASSERT_TRUE(sqrExp.equalsTo(ress->at(2))); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_EQ(res.at(0)->e(0), count); + ASSERT_TRUE(sumExp.equalsTo(res.at(1))); + ASSERT_TRUE(sqrExp.equalsTo(res.at(2))); - delete ress; + } //////////////////////////////////////////////////////////////////////////////// @@ -998,10 +996,9 @@ TEST_F(DeclarableOpsTests6, BinCount_1) { auto res = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); - delete res; } ///////////////////////////////////////////////////////////////////////////////// @@ -1023,10 +1020,8 @@ TEST_F(DeclarableOpsTests6, BinCount_2) { auto res = op.evaluate({&x, &weights}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - - delete res; + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); } ///////////////////////////////////////////////////////////////////////////////// @@ -1048,10 +1043,9 @@ TEST_F(DeclarableOpsTests6, BinCount_3) { auto res = op.evaluate({&x, &weights}, {}, {0, 2}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); - delete res; } ///////////////////////////////////////////////////////////////////////////////// @@ -1073,10 +1067,8 @@ TEST_F(DeclarableOpsTests6, BinCount_4) { auto res = op.evaluate({&x, &weights}, {}, {4, 4}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - - delete res; + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); } ///////////////////////////////////////////////////////////////////////////////// @@ -1098,11 +1090,10 @@ TEST_F(DeclarableOpsTests6, BinCount_5) { sd::ops::bincount op; auto res = op.evaluate({&x, &weights, &minV, &maxV}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); // res->at(0)->printBuffer("BC out"); - ASSERT_TRUE(exp.equalsTo(res->at(0))); + ASSERT_TRUE(exp.equalsTo(res.at(0))); - delete res; } ///////////////////////////////////////////////////////////////////////////////// @@ -1118,10 +1109,9 @@ TEST_F(DeclarableOpsTests6, BroadcastDynamicShape_1) { auto res = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); - delete res; } ///////////////////////////////////////////////////////////////////////////////// @@ -1136,10 +1126,9 @@ TEST_F(DeclarableOpsTests6, BroadcastDynamicShape_2) { sd::ops::broadcast_dynamic_shape op; auto res = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); - delete res; } ///////////////////////////////////////////////////////////////////////////////// @@ -1155,10 +1144,8 @@ TEST_F(DeclarableOpsTests6, BroadcastDynamicShape_3) { auto res = op.evaluate({&x, &y}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - - delete res; + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); } ///////////////////////////////////////////////////////////////////////////////// @@ -1174,11 +1161,9 @@ TEST_F(DeclarableOpsTests6, BroadcastDynamicShape_SGO_4) { auto res = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); //res->at(0)->printBuffer("Shape SGO 4"); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - - delete res; + ASSERT_TRUE(exp.equalsTo(res.at(0))); } ///////////////////////////////////////////////////////////////////////////////// @@ -1193,10 +1178,9 @@ TEST_F(DeclarableOpsTests6, BroadcastDynamicShape_SGO_6) { sd::ops::broadcast_dynamic_shape op; auto res = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); - delete res; } ///////////////////////////////////////////////////////////////////////////////// @@ -1211,10 +1195,8 @@ TEST_F(DeclarableOpsTests6, BroadcastDynamicShape_SGO_7) { sd::ops::broadcast_dynamic_shape op; auto res = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, res->status()); - ASSERT_TRUE(exp.equalsTo(res->at(0))); - - delete res; + ASSERT_EQ(ND4J_STATUS_OK, res.status()); + ASSERT_TRUE(exp.equalsTo(res.at(0))); } ///////////////////////////////////////////////////////////////////////////////// @@ -1276,10 +1258,10 @@ TEST_F(DeclarableOpsTests6, ClipByGlobalNorm_1) { sd::ops::clip_by_global_norm op; auto result = op.evaluate({&x}, {0.8}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); - auto norm = result->at(1); + auto z = result.at(0); + auto norm = result.at(1); //z->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expected"); //norm->printIndexedBuffer("Norm"); @@ -1288,7 +1270,7 @@ TEST_F(DeclarableOpsTests6, ClipByGlobalNorm_1) { ASSERT_TRUE(exp.equalsTo(z)); // ASSERT_TRUE(expNorm.equalsTo(norm)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1318,17 +1300,17 @@ TEST_F(DeclarableOpsTests6, ClipByGlobalNorm_2) { sd::ops::clip_by_global_norm op; auto result = op.evaluate({&x, &a}, {1.8}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); - auto y = result->at(1); + auto z = result.at(0); + auto y = result.at(1); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.isSameShape(y)); ASSERT_TRUE(exp.equalsTo(z)); ASSERT_TRUE(exp.equalsTo(y)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1348,21 +1330,21 @@ TEST_F(DeclarableOpsTests6, ClipByGlobalNorm_3) { sd::ops::clip_by_global_norm op; auto result = op.evaluate({&x, &a}, {0.8}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); - auto y = result->at(1); + auto z = result.at(0); + auto y = result.at(1); //z->printIndexedBuffer("Output 1"); //y->printIndexedBuffer("Output 2"); - //result->at(2)->printIndexedBuffer("Global norm is"); + //result.at(2)->printIndexedBuffer("Global norm is"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.isSameShape(y)); - ASSERT_TRUE(result->at(2)->isScalar()); + ASSERT_TRUE(result.at(2)->isScalar()); ASSERT_TRUE(exp.equalsTo(z)); ASSERT_TRUE(exp.equalsTo(y)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1374,16 +1356,16 @@ TEST_F(DeclarableOpsTests6, MatrixDeterminant_1) { sd::ops::matrix_determinant op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("Output "); //exp.printIndexedBuffer("Expected "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1395,16 +1377,16 @@ TEST_F(DeclarableOpsTests6, MatrixDeterminant_2) { sd::ops::matrix_determinant op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("Output "); //exp.printIndexedBuffer("Expected "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1416,16 +1398,16 @@ TEST_F(DeclarableOpsTests6, MatrixDeterminant_3) { sd::ops::matrix_determinant op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("Output "); //exp.printIndexedBuffer("Expected "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1437,16 +1419,16 @@ TEST_F(DeclarableOpsTests6, MatrixDeterminant_4) { sd::ops::matrix_determinant op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Output "); // exp.printIndexedBuffer("Expected "); // z->printShapeInfo("Output shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1461,16 +1443,16 @@ TEST_F(DeclarableOpsTests6, MatrixDeterminant_5) { sd::ops::matrix_determinant op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("Output "); //exp.printIndexedBuffer("Expected "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1485,9 +1467,9 @@ TEST_F(DeclarableOpsTests6, MatrixDeterminant_6) { sd::ops::matrix_determinant op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("Output "); //z->printShapeInfo("Shape"); //exp.printIndexedBuffer("Expected "); @@ -1495,7 +1477,7 @@ TEST_F(DeclarableOpsTests6, MatrixDeterminant_6) { ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1507,14 +1489,14 @@ TEST_F(DeclarableOpsTests6, LogMatrixDeterminant_1) { sd::ops::log_matrix_determinant op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1526,13 +1508,13 @@ TEST_F(DeclarableOpsTests6, LogDet_1) { sd::ops::logdet op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1544,14 +1526,14 @@ TEST_F(DeclarableOpsTests6, LogDet_2) { sd::ops::logdet op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1563,14 +1545,14 @@ TEST_F(DeclarableOpsTests6, LogDet_3) { sd::ops::logdet op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1607,14 +1589,14 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_1) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1626,14 +1608,14 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_010) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1645,14 +1627,14 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_01) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1664,14 +1646,14 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_02) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1709,16 +1691,16 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_2) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); z->printIndexedBuffer("Output "); exp.printIndexedBuffer("Expected "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } */ TEST_F(DeclarableOpsTests6, MatrixInverse_03) { @@ -1742,16 +1724,16 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_03) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Output "); // exp.printIndexedBuffer("Expected "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1776,16 +1758,16 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_3) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // exp.printIndexedBuffer("Expected "); // z->printIndexedBuffer("Output "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1810,16 +1792,16 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_4) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Output "); // exp.printIndexedBuffer("Expected "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1844,16 +1826,16 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_04) { sd::ops::matrix_inverse op; auto result = op.evaluate({&x}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Output "); // exp.printIndexedBuffer("Expected "); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1872,9 +1854,9 @@ TEST_F(DeclarableOpsTests6, ReluLayer_1) { sd::ops::relu_layer op; auto result = op.evaluate({&x, &w, &b}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("Output shape"); // z->printIndexedBuffer("Output "); // exp.printIndexedBuffer("Expected "); @@ -1882,7 +1864,7 @@ TEST_F(DeclarableOpsTests6, ReluLayer_1) { ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_Reduce3_Edge) { @@ -1925,17 +1907,17 @@ TEST_F(DeclarableOpsTests6, static_rnn_test1) { sd::ops::static_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b, &h0, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -1968,17 +1950,17 @@ TEST_F(DeclarableOpsTests6, static_rnn_test2) { sd::ops::static_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b, &h0}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2011,17 +1993,17 @@ TEST_F(DeclarableOpsTests6, static_rnn_test3) { sd::ops::static_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b, &h0, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2053,17 +2035,17 @@ TEST_F(DeclarableOpsTests6, static_rnn_test4) { sd::ops::static_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2095,17 +2077,17 @@ TEST_F(DeclarableOpsTests6, static_rnn_test5) { sd::ops::static_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2146,11 +2128,11 @@ TEST_F(DeclarableOpsTests6, static_bidir_rnn_test1) { sd::ops::static_bidirectional_rnn op; auto results = op.evaluate({&x, &WxFW,&WhFW,&bFW, &WxFW,&WhFW,&bFW, &h0FW, &h0BW, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFWfinal = results->at(1); - auto hBWfinal = results->at(2); + auto h = results.at(0); + auto hFWfinal = results.at(1); + auto hBWfinal = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -2159,7 +2141,7 @@ TEST_F(DeclarableOpsTests6, static_bidir_rnn_test1) { ASSERT_TRUE(expHBWfinal.isSameShape(hBWfinal)); ASSERT_TRUE(expHBWfinal.equalsTo(hBWfinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2199,11 +2181,11 @@ TEST_F(DeclarableOpsTests6, static_bidir_rnn_test2) { sd::ops::static_bidirectional_rnn op; auto results = op.evaluate({&x, &WxFW,&WhFW,&bFW, &WxFW,&WhFW,&bFW, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFWfinal = results->at(1); - auto hBWfinal = results->at(2); + auto h = results.at(0); + auto hFWfinal = results.at(1); + auto hBWfinal = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -2212,7 +2194,7 @@ TEST_F(DeclarableOpsTests6, static_bidir_rnn_test2) { ASSERT_TRUE(expHBWfinal.isSameShape(hBWfinal)); ASSERT_TRUE(expHBWfinal.equalsTo(hBWfinal)); - delete results; + } @@ -2252,11 +2234,11 @@ TEST_F(DeclarableOpsTests6, static_bidir_rnn_test3) { sd::ops::static_bidirectional_rnn op; auto results = op.evaluate({&x, &WxFW,&WhFW,&bFW, &WxFW,&WhFW,&bFW}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFWfinal = results->at(1); - auto hBWfinal = results->at(2); + auto h = results.at(0); + auto hFWfinal = results.at(1); + auto hBWfinal = results.at(2); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); @@ -2265,7 +2247,7 @@ TEST_F(DeclarableOpsTests6, static_bidir_rnn_test3) { ASSERT_TRUE(expHBWfinal.isSameShape(hBWfinal)); ASSERT_TRUE(expHBWfinal.equalsTo(hBWfinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2298,17 +2280,17 @@ TEST_F(DeclarableOpsTests6, dynamic_rnn_test1) { sd::ops::dynamic_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b, &h0, &maxTimeStep}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } @@ -2343,17 +2325,17 @@ TEST_F(DeclarableOpsTests6, dynamic_rnn_test2) { sd::ops::dynamic_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b, &h0, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2385,17 +2367,17 @@ TEST_F(DeclarableOpsTests6, dynamic_rnn_test3) { sd::ops::dynamic_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b, &h0}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2426,17 +2408,17 @@ TEST_F(DeclarableOpsTests6, dynamic_rnn_test4) { sd::ops::dynamic_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2467,17 +2449,17 @@ TEST_F(DeclarableOpsTests6, dynamic_rnn_test5) { sd::ops::dynamic_rnn op; auto results = op.evaluate({&x, &Wx, &Wh, &b}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto h = results->at(0); - auto hFinal = results->at(1); + auto h = results.at(0); + auto hFinal = results.at(1); ASSERT_TRUE(expH.isSameShape(h)); ASSERT_TRUE(expH.equalsTo(h)); ASSERT_TRUE(expHFinal.isSameShape(hFinal)); ASSERT_TRUE(expHFinal.equalsTo(hFinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2523,12 +2505,12 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test1) { sd::ops::dynamic_bidirectional_rnn op; auto results = op.evaluate({&x, &WxFW,&WhFW,&bFW, &WxFW,&WhFW,&bFW, &h0FW, &h0BW, &maxTimeStep}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto hFW = results->at(0); - auto hBW = results->at(1); - auto hFWfinal = results->at(2); - auto hBWfinal = results->at(3); + auto hFW = results.at(0); + auto hBW = results.at(1); + auto hFWfinal = results.at(2); + auto hBWfinal = results.at(3); ASSERT_TRUE(expHFW.isSameShape(hFW)); ASSERT_TRUE(expHFW.equalsTo(hFW)); @@ -2539,7 +2521,7 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test1) { ASSERT_TRUE(expHBWfinal.isSameShape(hBWfinal)); ASSERT_TRUE(expHBWfinal.equalsTo(hBWfinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2583,12 +2565,12 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test2) { sd::ops::dynamic_bidirectional_rnn op; auto results = op.evaluate({&x, &WxFW,&WhFW,&bFW, &WxFW,&WhFW,&bFW, &h0FW, &h0BW, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto hFW = results->at(0); - auto hBW = results->at(1); - auto hFWfinal = results->at(2); - auto hBWfinal = results->at(3); + auto hFW = results.at(0); + auto hBW = results.at(1); + auto hFWfinal = results.at(2); + auto hBWfinal = results.at(3); ASSERT_TRUE(expHFW.isSameShape(hFW)); ASSERT_TRUE(expHFW.equalsTo(hFW)); @@ -2599,7 +2581,7 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test2) { ASSERT_TRUE(expHBWfinal.isSameShape(hBWfinal)); ASSERT_TRUE(expHBWfinal.equalsTo(hBWfinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2639,12 +2621,12 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test3) { sd::ops::dynamic_bidirectional_rnn op; auto results = op.evaluate({&x, &WxFW,&WhFW,&bFW, &WxFW,&WhFW,&bFW, &maxTimeStep}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto hFW = results->at(0); - auto hBW = results->at(1); - auto hFWfinal = results->at(2); - auto hBWfinal = results->at(3); + auto hFW = results.at(0); + auto hBW = results.at(1); + auto hFWfinal = results.at(2); + auto hBWfinal = results.at(3); ASSERT_TRUE(expHFW.isSameShape(hFW)); ASSERT_TRUE(expHFW.equalsTo(hFW)); @@ -2655,7 +2637,7 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test3) { ASSERT_TRUE(expHBWfinal.isSameShape(hBWfinal)); ASSERT_TRUE(expHBWfinal.equalsTo(hBWfinal)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2698,12 +2680,12 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test4) { sd::ops::dynamic_bidirectional_rnn op; auto results = op.evaluate({&x, &WxFW,&WhFW,&bFW, &WxFW,&WhFW,&bFW, &h0FW, &h0BW}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto hFW = results->at(0); - auto hBW = results->at(1); - auto hFWfinal = results->at(2); - auto hBWfinal = results->at(3); + auto hFW = results.at(0); + auto hBW = results.at(1); + auto hFWfinal = results.at(2); + auto hBWfinal = results.at(3); ASSERT_TRUE(expHFW.isSameShape(hFW)); ASSERT_TRUE(expHFW.equalsTo(hFW)); @@ -2714,7 +2696,7 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test4) { ASSERT_TRUE(expHBWfinal.isSameShape(hBWfinal)); ASSERT_TRUE(expHBWfinal.equalsTo(hBWfinal)); - delete results; + } TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test5) { @@ -2751,12 +2733,12 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test5) { sd::ops::dynamic_bidirectional_rnn op; auto results = op.evaluate({&x, &WxFW,&WhFW,&bFW, &WxFW,&WhFW,&bFW}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto hFW = results->at(0); - auto hBW = results->at(1); - auto hFWfinal = results->at(2); - auto hBWfinal = results->at(3); + auto hFW = results.at(0); + auto hBW = results.at(1); + auto hFWfinal = results.at(2); + auto hBWfinal = results.at(3); ASSERT_TRUE(expHFW.isSameShape(hFW)); ASSERT_TRUE(expHFW.equalsTo(hFW)); @@ -2767,7 +2749,7 @@ TEST_F(DeclarableOpsTests6, dynamic_bidir_rnn_test5) { ASSERT_TRUE(expHBWfinal.isSameShape(hBWfinal)); ASSERT_TRUE(expHBWfinal.equalsTo(hBWfinal)); - delete results; + } @@ -2777,11 +2759,11 @@ TEST_F(DeclarableOpsTests6, Test_Diag_119_1) { sd::ops::diag op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(e, *result->at(0)); + ASSERT_EQ(e, *result.at(0)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_Diag_119_2) { @@ -2790,11 +2772,11 @@ TEST_F(DeclarableOpsTests6, Test_Diag_119_2) { sd::ops::diag op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(e, *result->at(0)); + ASSERT_EQ(e, *result.at(0)); - delete result; + } TEST_F(DeclarableOpsTests6, Test_Diag_119_3) { @@ -2803,11 +2785,11 @@ TEST_F(DeclarableOpsTests6, Test_Diag_119_3) { sd::ops::diag op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(e, *result->at(0)); + ASSERT_EQ(e, *result.at(0)); - delete result; + } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests7.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests7.cpp index 65ee84030..7f39c3d76 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests7.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests7.cpp @@ -62,14 +62,14 @@ TEST_F(DeclarableOpsTests7, Test_CHOOSE_SCALAR_LARGE) { sd::ops::choose op; //greater than test auto result = op.evaluate({&x}, {0.0},{3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(1); + auto z = result.at(1); ASSERT_EQ(148,z->e(0)); //ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } @@ -85,14 +85,14 @@ TEST_F(DeclarableOpsTests7, Test_CHOOSE_SCALAR_ZERO) { sd::ops::choose op; //greater than test auto result = op.evaluate({&x}, {0.0},{3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(1); + auto z = result.at(1); auto array = *z; ASSERT_EQ(3,array.e(0)); //ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } @@ -110,13 +110,13 @@ TEST_F(DeclarableOpsTests7, Test_CHOOSE_SCALAR) { sd::ops::choose op; //greater than test auto result = op.evaluate({&x,&scalar}, {1.0},{3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(3, z->lengthOf()); //ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } @@ -134,13 +134,13 @@ TEST_F(DeclarableOpsTests7, Test_CHOOSE_SCALAR_LEFT) { sd::ops::choose op; //greater than test auto result = op.evaluate({&scalar,&x}, {1.0},{3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(3,z->lengthOf()); //ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } @@ -157,13 +157,13 @@ TEST_F(DeclarableOpsTests7, Test_CHOOSE_ONLY_SCALAR) { sd::ops::choose op; //greater than test auto result = op.evaluate({&x}, {1.0},{3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(2,z->lengthOf()); //ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } @@ -180,13 +180,13 @@ TEST_F(DeclarableOpsTests7, Test_CHOOSE_ONLY_SCALAR_GTE) { sd::ops::choose op; //greater than test auto result = op.evaluate({&x}, {1.0},{5}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(3,z->lengthOf()); //ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } @@ -227,7 +227,7 @@ TEST_F(DeclarableOpsTests7, TEST_WHERE) { ASSERT_EQ(Status::OK(), result); for(int i = 0; i < 4; i++) ASSERT_EQ(assertion[i],resultArr.e(i)); - // auto z = result->at(0); + // auto z = result.at(0); //ASSERT_EQ(4,z->lengthOf()); //ASSERT_TRUE(exp.isSameShape(z)); @@ -295,10 +295,10 @@ TEST_F(DeclarableOpsTests7, TEST_WHERE_SCALAR) { // Nd4jStatus execute(std::initializer_list*> inputs, std::initializer_list*> outputs , std::initializer_list tArgs, std::initializer_list iArgs, bool isInplace = false); auto result = op.execute({&maskArr,&x,&putArr},{&resultArr}, {},{3}, {}, {}, false); - // ASSERT_EQ(Status::OK(), result->status()); + // ASSERT_EQ(Status::OK(), result.status()); for(int i = 0; i < 4; i++) ASSERT_EQ(assertion[i],resultArr.e(i)); - // auto z = result->at(0); + // auto z = result.at(0); //ASSERT_EQ(4,z->lengthOf()); //ASSERT_TRUE(exp.isSameShape(z)); @@ -316,10 +316,10 @@ TEST_F(DeclarableOpsTests7, TestMatrixDiagPart_1) { auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(z.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(z.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -332,10 +332,10 @@ TEST_F(DeclarableOpsTests7, TestMatrixDiagPart_2) { auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(z.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(z.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -348,10 +348,10 @@ TEST_F(DeclarableOpsTests7, TestMatrixDiag_1) { auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(z.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(z.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -362,10 +362,10 @@ TEST_F(DeclarableOpsTests7, TestMatrixDiag_2) { sd::ops::matrix_diag op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(z.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(z.equalsTo(result.at(0))); - delete result; + } @@ -376,11 +376,11 @@ TEST_F(DeclarableOpsTests7, TestRandomCrop_1) { sd::ops::random_crop op; auto result = op.evaluate({&x, &shape}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); -// ASSERT_TRUE(z.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); +// ASSERT_TRUE(z.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -390,11 +390,11 @@ TEST_F(DeclarableOpsTests7, TestRandomCrop_2) { sd::ops::random_crop op; auto result = op.evaluate({&x, &shape}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); -// ASSERT_TRUE(z.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); +// ASSERT_TRUE(z.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -427,13 +427,13 @@ TEST_F(DeclarableOpsTests7, Test_Dynamic_Stitch_119) { sd::ops::dynamic_stitch op; auto result = op.evaluate({&indices0, &indices1, &indices2, &data0, &data1, &data2}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); -// result->at(0)->printIndexedBuffer("Output"); + ASSERT_EQ(Status::OK(), result.status()); +// result.at(0)->printIndexedBuffer("Output"); // exp.printIndexedBuffer("Expect"); -// result->at(0)->printShapeInfo("Output shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); - delete result; +// result.at(0)->printShapeInfo("Output shape"); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, Test_Dynamic_Stitch_Prof_1) { @@ -465,13 +465,13 @@ TEST_F(DeclarableOpsTests7, Test_Dynamic_Stitch_Prof_1) { sd::ops::dynamic_stitch op; auto result = op.evaluate({&indices0, &indices1, &indices2, &data0, &data1, &data2}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); -// result->at(0)->printIndexedBuffer("Output"); + ASSERT_EQ(Status::OK(), result.status()); +// result.at(0)->printIndexedBuffer("Output"); // exp.printIndexedBuffer("Expect"); -// result->at(0)->printShapeInfo("Output shape"); - auto res = result->at(0); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); +// result.at(0)->printShapeInfo("Output shape"); + auto res = result.at(0); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); int numOfCases = 100; auto timeStart = std::chrono::system_clock::now(); @@ -483,7 +483,7 @@ TEST_F(DeclarableOpsTests7, Test_Dynamic_Stitch_Prof_1) { auto outerTime = std::chrono::duration_cast (timeEnd - timeStart).count(); //nd4j_printf("dynamic_stitch: Process with %i iterations was load: %lld us.\n", numOfCases, outerTime / numOfCases); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -569,13 +569,13 @@ TEST_F(DeclarableOpsTests7, Test_Dynamic_Stitch_119_1) { sd::ops::dynamic_stitch op; auto result = op.evaluate({&indices0, &indices1, &indices2, &data0, &data1, &data2}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); ASSERT_TRUE(z->isSameShape(exp)); ASSERT_TRUE(z->equalsTo(exp)); - delete result; + } TEST_F(DeclarableOpsTests7, Test_Dynamic_Stitch_119_2) { @@ -660,13 +660,13 @@ TEST_F(DeclarableOpsTests7, Test_Dynamic_Stitch_119_2) { sd::ops::dynamic_stitch op; auto result = op.evaluate({&indices0, &indices1, &indices2, &data0, &data1, &data2}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); ASSERT_TRUE(z->isSameShape(exp)); ASSERT_TRUE(z->equalsTo(exp)); - delete result; + } TEST_F(DeclarableOpsTests7, Test_Dynamic_Partition_119) { @@ -677,13 +677,13 @@ TEST_F(DeclarableOpsTests7, Test_Dynamic_Partition_119) { e.assign(1.f); sd::ops::dynamic_partition op; auto result = op.evaluate({&x, &y}, {}, {4}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_EQ(4, result->size()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_EQ(4, result.size()); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); - delete result; + } TEST_F(DeclarableOpsTests7, Test_Dynamic_Partition_119_1) { @@ -696,20 +696,20 @@ TEST_F(DeclarableOpsTests7, Test_Dynamic_Partition_119_1) { // e.assign(1.f); sd::ops::dynamic_partition op; auto result = op.evaluate({&x, &y}, {}, {3}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_EQ(3, result->size()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_EQ(3, result.size()); + auto z = result.at(0); // z->printShapeInfo("Output shape info"); -// result->at(1)->printShapeInfo("Shape2"); -// result->at(2)->printShapeInfo("Shape3"); -// result->at(3)->printShapeInfo("Shape4"); +// result.at(1)->printShapeInfo("Shape2"); +// result.at(2)->printShapeInfo("Shape3"); +// result.at(3)->printShapeInfo("Shape4"); // z->printIndexedBuffer("Output1"); -// result->at(1)->printIndexedBuffer("Output2"); -// result->at(2)->printIndexedBuffer("Output3"); -// result->at(3)->printIndexedBuffer("Output4"); +// result.at(1)->printIndexedBuffer("Output2"); +// result.at(2)->printIndexedBuffer("Output3"); +// result.at(3)->printIndexedBuffer("Output4"); ASSERT_TRUE(e.isSameShape(z)); - delete result; + } TEST_F(DeclarableOpsTests7, Test_Dynamic_Partition_119_2) { auto x = NDArrayFactory::create('c', {5, 4, 11}); @@ -739,20 +739,20 @@ TEST_F(DeclarableOpsTests7, Test_Dynamic_Partition_119_2) { //.assign(1.f); sd::ops::dynamic_partition op; auto result = op.evaluate({&x, &y}, {}, {4}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_EQ(4, result->size()); - for (size_t i = 0; i < result->size(); i++) { - auto z = result->at(i); + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_EQ(4, result.size()); + for (size_t i = 0; i < result.size(); i++) { + auto z = result.at(i); // z->printShapeInfo("Output shape info"); // z->printIndexedBuffer("Output1"); -// result->at(1)->printIndexedBuffer("Output2"); -// result->at(2)->printIndexedBuffer("Output3"); -// result->at(3)->printIndexedBuffer("Output4"); +// result.at(1)->printIndexedBuffer("Output2"); +// result.at(2)->printIndexedBuffer("Output3"); +// result.at(3)->printIndexedBuffer("Output4"); ASSERT_TRUE(e[i]->isSameShape(z)); ASSERT_TRUE(e[i]->equalsTo(z)); } - delete result; + } @@ -769,15 +769,15 @@ TEST_F(DeclarableOpsTests7, Test_SequenceMask_1) { sd::ops::sequence_mask op; auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Output"); // z->printShapeInfo("Shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -791,15 +791,15 @@ TEST_F(DeclarableOpsTests7, Test_SequenceMask_2) { sd::ops::sequence_mask op; auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer("Output"); // z->printShapeInfo("Shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests7, Test_SequenceMask_3) { @@ -812,15 +812,15 @@ TEST_F(DeclarableOpsTests7, Test_SequenceMask_3) { sd::ops::sequence_mask op; auto result = op.evaluate({&input}, {sd::DataType::INT32}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer("Output"); // z->printShapeInfo("Shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests7, Test_SequenceMask_4) { @@ -832,15 +832,15 @@ TEST_F(DeclarableOpsTests7, Test_SequenceMask_4) { sd::ops::sequence_mask op; auto result = op.evaluate({&input, &maxLen}, {sd::DataType::FLOAT32}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer("Output"); // z->printShapeInfo("Shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(DeclarableOpsTests7, Test_SequenceMask_5) { @@ -851,15 +851,15 @@ TEST_F(DeclarableOpsTests7, Test_SequenceMask_5) { sd::ops::sequence_mask op; auto result = op.evaluate({&input}, {5, (int)sd::DataType::FLOAT32}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer("Output"); // z->printShapeInfo("Shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -871,12 +871,12 @@ TEST_F(DeclarableOpsTests7, TestSegmentMax_1) { sd::ops::segment_max op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printBuffer("MaX1"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printBuffer("MaX1"); // exp.printBuffer("ExP1"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestSegmentMax_01) { @@ -887,12 +887,12 @@ TEST_F(DeclarableOpsTests7, TestSegmentMax_01) { sd::ops::segment_max op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printBuffer("MaX01"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printBuffer("MaX01"); // exp.printBuffer("ExP01"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestSegmentMaxBP_1) { @@ -903,11 +903,11 @@ TEST_F(DeclarableOpsTests7, TestSegmentMaxBP_1) { sd::ops::segment_max_bp op; eps.linspace(1); auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("OutputMaxBP"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("OutputMaxBP"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -926,15 +926,15 @@ TEST_F(DeclarableOpsTests7, TestSegmentMax_2) { sd::ops::segment_max op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); + auto out = result.at(0); // out->printIndexedBuffer("Output2Max"); // exp.printIndexedBuffer("Expect2Max"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -950,14 +950,14 @@ TEST_F(DeclarableOpsTests7, TestSegmentMaxBP_2) { sd::ops::segment_max_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 2); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 2); //exp.printIndexedBuffer("BP Max Expect"); - //result->at(0)->printIndexedBuffer("BP Max Output"); + //result.at(0)->printIndexedBuffer("BP Max Output"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -978,14 +978,14 @@ TEST_F(DeclarableOpsTests7, TestSegmentMax_3) { sd::ops::segment_max op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output3Max"); -// result->at(0)->printShapeInfo("Out Shape 3 Max"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output3Max"); +// result.at(0)->printShapeInfo("Out Shape 3 Max"); // exp.printIndexedBuffer("Expect3Max"); // exp.printShapeInfo("Exp Shape 3 Max"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1006,15 +1006,15 @@ TEST_F(DeclarableOpsTests7, TestSegmentMax_4) { sd::ops::segment_max op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1026,10 +1026,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMax_1) { sd::ops::unsorted_segment_max op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1041,10 +1041,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMaxBP_1) { sd::ops::segment_max_bp op; eps.linspace(1); auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1056,12 +1056,12 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMaxBP_2) { sd::ops::segment_max_bp op; eps.linspace(1); auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expect"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1073,11 +1073,11 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMax_2) { sd::ops::unsorted_segment_max op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("OutputUnsortedMax"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("OutputUnsortedMax"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1091,13 +1091,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMax_3) { sd::ops::unsorted_segment_max op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); //exp.printIndexedBuffer("Expect"); - //result->at(0)->printIndexedBuffer("Output"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + //result.at(0)->printIndexedBuffer("Output"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1114,13 +1114,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMax_4) { sd::ops::unsorted_segment_max op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); //exp.printIndexedBuffer("Expect"); - //result->at(0)->printIndexedBuffer("Output"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + //result.at(0)->printIndexedBuffer("Output"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestSegmentMin_1) { @@ -1131,12 +1131,12 @@ TEST_F(DeclarableOpsTests7, TestSegmentMin_1) { sd::ops::segment_min op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1148,12 +1148,12 @@ TEST_F(DeclarableOpsTests7, TestSegmentMin_01) { sd::ops::segment_min op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestSegmentMin_02) { @@ -1164,12 +1164,12 @@ TEST_F(DeclarableOpsTests7, TestSegmentMin_02) { sd::ops::segment_min op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1182,11 +1182,11 @@ TEST_F(DeclarableOpsTests7, TestSegmentMinBP_1) { sd::ops::segment_min_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1199,13 +1199,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMinBP_1) { sd::ops::unsorted_segment_min_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output1"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output1"); //exp.printIndexedBuffer("Expecte"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1218,13 +1218,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMinBP_2) { sd::ops::unsorted_segment_min_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output1"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output1"); //exp.printIndexedBuffer("Expecte"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1238,13 +1238,13 @@ TEST_F(DeclarableOpsTests7, TestSegmentMin_2) { sd::ops::segment_min op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1259,13 +1259,13 @@ TEST_F(DeclarableOpsTests7, TestSegmentMinBP_2) { sd::ops::segment_min_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 2); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 2); // exp.printIndexedBuffer("Expect"); -// result->at(0)->printIndexedBuffer("Output"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); +// result.at(0)->printIndexedBuffer("Output"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1284,14 +1284,14 @@ TEST_F(DeclarableOpsTests7, TestSegmentMin_3) { sd::ops::segment_min op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1314,15 +1314,15 @@ TEST_F(DeclarableOpsTests7, TestSegmentMin_4) { sd::ops::segment_min op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1334,10 +1334,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMin_1) { sd::ops::unsorted_segment_min op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMin_01) { @@ -1348,10 +1348,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMin_01) { sd::ops::unsorted_segment_min op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1365,13 +1365,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMin_2) { sd::ops::unsorted_segment_min op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1389,14 +1389,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMin_3) { sd::ops::unsorted_segment_min op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1430,15 +1430,15 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMin_4) { sd::ops::unsorted_segment_min op; auto result = op.evaluate({&x, &idx}, {}, {8}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1450,10 +1450,10 @@ TEST_F(DeclarableOpsTests7, TestSegmentMean_1) { sd::ops::segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } TEST_F(DeclarableOpsTests7, TestSegmentMean_2) { @@ -1464,14 +1464,14 @@ TEST_F(DeclarableOpsTests7, TestSegmentMean_2) { sd::ops::segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); -// result->at(0)->printIndexedBuffer("Output"); +// result.at(0)->printIndexedBuffer("Output"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } TEST_F(DeclarableOpsTests7, TestSegmentMean_02) { @@ -1482,11 +1482,11 @@ TEST_F(DeclarableOpsTests7, TestSegmentMean_02) { sd::ops::segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } TEST_F(DeclarableOpsTests7, TestSegmentMean_021) { @@ -1497,11 +1497,11 @@ TEST_F(DeclarableOpsTests7, TestSegmentMean_021) { sd::ops::segment_mean op; x.linspace(1.); auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } TEST_F(DeclarableOpsTests7, TestSegmentMean_022) { @@ -1517,7 +1517,7 @@ TEST_F(DeclarableOpsTests7, TestSegmentMean_022) { ASSERT_TRUE(exp.equalsTo(z)); -// delete result; +// } //////////////////////////////////////////////////////////////////////////////// @@ -1531,11 +1531,11 @@ TEST_F(DeclarableOpsTests7, TestSegmentMeanBP_2) { sd::ops::segment_mean_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 2); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 2); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1556,14 +1556,14 @@ TEST_F(DeclarableOpsTests7, TestSegmentMean_3) { sd::ops::segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1587,15 +1587,15 @@ TEST_F(DeclarableOpsTests7, TestSegmentMean_4) { sd::ops::segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1607,10 +1607,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMean_1) { sd::ops::unsorted_segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1623,10 +1623,10 @@ TEST_F(DeclarableOpsTests7, TestSegmentMeanBP_1) { sd::ops::segment_mean_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1639,10 +1639,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMeanBP_1) { sd::ops::unsorted_segment_mean_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1655,10 +1655,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMeanBP_2) { sd::ops::unsorted_segment_mean_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1670,14 +1670,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMean_2) { sd::ops::unsorted_segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); -// result->at(0)->printIndexedBuffer("Output"); +// result.at(0)->printIndexedBuffer("Output"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1698,14 +1698,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMean_3) { sd::ops::unsorted_segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1729,15 +1729,15 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentMean_4) { sd::ops::unsorted_segment_mean op; auto result = op.evaluate({&x, &idx}, {}, {8}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1749,10 +1749,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSqrtN_1) { sd::ops::unsorted_segment_sqrt_n op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1765,11 +1765,11 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSqrtN_BP_1) { sd::ops::unsorted_segment_sqrt_n_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Hello Out:"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Hello Out:"); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1784,14 +1784,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSqrtN_2) { sd::ops::unsorted_segment_sqrt_n op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); -// result->at(0)->printIndexedBuffer("Output"); +// result.at(0)->printIndexedBuffer("Output"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1812,14 +1812,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSqrtN_3) { sd::ops::unsorted_segment_sqrt_n op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1843,15 +1843,15 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSqrtN_4) { sd::ops::unsorted_segment_sqrt_n op; auto result = op.evaluate({&x, &idx}, {}, {8}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1863,12 +1863,12 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSqrtN_5) { sd::ops::unsorted_segment_sqrt_n op; auto result = op.evaluate({&x, &idx}, {}, {4}); - ASSERT_EQ(result->status(), Status::OK()); - // result->at(0)->printIndexedBuffer("Output"); + ASSERT_EQ(result.status(), Status::OK()); + // result.at(0)->printIndexedBuffer("Output"); // exp.printIndexedBuffer("Expect"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1880,11 +1880,11 @@ TEST_F(DeclarableOpsTests7, TestSegmentSum_1) { sd::ops::segment_sum op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1896,10 +1896,10 @@ TEST_F(DeclarableOpsTests7, TestSegmentSumBP_1) { sd::ops::segment_sum_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSumBP_1) { @@ -1910,10 +1910,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSumBP_1) { sd::ops::unsorted_segment_sum_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSumBP_2) { @@ -1924,10 +1924,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSumBP_2) { sd::ops::unsorted_segment_sum_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1939,13 +1939,13 @@ TEST_F(DeclarableOpsTests7, TestSegmentSum_2) { sd::ops::segment_sum op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1959,13 +1959,13 @@ TEST_F(DeclarableOpsTests7, TestSegmentSumBP_2) { sd::ops::segment_sum_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 2); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 2); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1986,14 +1986,14 @@ TEST_F(DeclarableOpsTests7, TestSegmentSum_3) { sd::ops::segment_sum op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2017,15 +2017,15 @@ TEST_F(DeclarableOpsTests7, TestSegmentSum_4) { sd::ops::segment_sum op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2037,10 +2037,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSum_1) { sd::ops::unsorted_segment_sum op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2052,11 +2052,11 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSum_2) { sd::ops::unsorted_segment_sum op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2077,14 +2077,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSum_3) { sd::ops::unsorted_segment_sum op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2107,15 +2107,15 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentSum_4) { sd::ops::unsorted_segment_sum op; auto result = op.evaluate({&x, &idx}, {}, {8}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2127,10 +2127,10 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_1) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2142,13 +2142,13 @@ TEST_F(DeclarableOpsTests7, TestSegmentProdBP_1) { sd::ops::segment_prod_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("ProdBP Output"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("ProdBP Output"); // exp.printIndexedBuffer("ProdBP Expect"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2160,13 +2160,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProdBP_1) { sd::ops::segment_prod_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("ProdBP Output"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("ProdBP Output"); //exp.printIndexedBuffer("ProdBP Expect"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2179,13 +2179,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProdBP_2) { sd::ops::unsorted_segment_prod_bp op; auto result = op.evaluate({&x, &idx, &eps, &n}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Unsorted ProdBP Output"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Unsorted ProdBP Output"); //exp.printIndexedBuffer("Unsorted ProdBP Expect"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2200,13 +2200,13 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_2) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2224,13 +2224,13 @@ TEST_F(DeclarableOpsTests7, TestSegmentProdBP_2) { sd::ops::segment_prod_bp op; auto result = op.evaluate({&x, &idx, &eps}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 2); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 2); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2251,14 +2251,14 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_3) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2273,10 +2273,10 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_04) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestSegmentProd_05) { @@ -2290,12 +2290,12 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_05) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - auto res = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto res = result.at(0); // res->printIndexedBuffer("Segment prod 05"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestSegmentProd_05_1) { @@ -2309,12 +2309,12 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_05_1) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - auto res = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto res = result.at(0); // res->printIndexedBuffer("Segment prod 05_1"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2328,10 +2328,10 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_06) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2345,10 +2345,10 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_07) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2362,10 +2362,10 @@ TEST_F(DeclarableOpsTests7, TestSegmentProd_08) { sd::ops::segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2377,10 +2377,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_1) { sd::ops::unsorted_segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2392,10 +2392,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_11) { sd::ops::unsorted_segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {5}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_2) { @@ -2409,13 +2409,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_2) { sd::ops::unsorted_segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2431,13 +2431,13 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_12) { sd::ops::unsorted_segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_EQ(result->size(), 1); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_EQ(result.size(), 1); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_08) { @@ -2450,10 +2450,10 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_08) { sd::ops::unsorted_segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {4}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2474,14 +2474,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_3) { sd::ops::unsorted_segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2505,14 +2505,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_4) { sd::ops::unsorted_segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {3}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2540,14 +2540,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProd_5) { sd::ops::unsorted_segment_prod op; auto result = op.evaluate({&x, &idx}, {}, {4}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); -// result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); +// result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2571,14 +2571,14 @@ TEST_F(DeclarableOpsTests7, TestUnsortedSegmentProdBP_4) { sd::ops::unsorted_segment_prod_bp op; auto result = op.evaluate({&x, &idx, &gradO}, {}, {4}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); //exp.printIndexedBuffer("Expect"); // exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2609,15 +2609,15 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_1) { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {1,1,1,1,1,1,0}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } @@ -2646,12 +2646,12 @@ auto exp = NDArrayFactory::create('c', {3, 1, 1, 12}, { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,2, 3,3, 1,1,0}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } @@ -2680,12 +2680,12 @@ auto exp = NDArrayFactory::create('c', {3, 1, 2, 6}, { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,1,3,2,2,2,0}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } @@ -2719,15 +2719,15 @@ auto exp = NDArrayFactory::create('c', {3, 3, 4, 3}, { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {1,1,1,1,1,1,0}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2758,15 +2758,15 @@ auto exp = NDArrayFactory::create('c', {3, 1, 1, 18}, { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {3,2,3,2,1,2,0}); - ASSERT_EQ(result->status(), Status::OK()); -// result->at(0)->printIndexedBuffer("Output"); - //result->at(0)->printShapeInfo("Out Shape"); + ASSERT_EQ(result.status(), Status::OK()); +// result.at(0)->printIndexedBuffer("Output"); + //result.at(0)->printShapeInfo("Out Shape"); // exp.printIndexedBuffer("Expect"); //exp.printShapeInfo("Exp Shape"); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2787,11 +2787,11 @@ auto exp = NDArrayFactory::create('c', {2, 1, 4, 4}, { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,1, 1,1, 1,1,0}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2809,19 +2809,19 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_7) { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,2, 1,1, 1,1, 1}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="SAME" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("Output"); // exp.printBuffer("Expect"); // for (Nd4jLong e = 0; e < exp.lengthOf(); e++) // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2840,19 +2840,19 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_8) { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,2, 1,1, 1,1, 1}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="SAME" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("Output"); // exp.printBuffer("Expect"); // for (Nd4jLong e = 0; e < exp.lengthOf(); e++) // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2904,19 +2904,19 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_9) { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {3,3, 1,1, 1,1, 1}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="SAME" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("OutputSame"); // exp.printBuffer("ExpectSame"); // for (Nd4jLong e = 0; e < exp.lengthOf(); e++) // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2945,19 +2945,19 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_9_1) { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,2, 1,1, 1,1, 1}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="SAME" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("OutputSame"); // exp.printBuffer("ExpectSame"); // for (Nd4jLong e = 0; e < exp.lengthOf(); e++) // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } // @@ -2992,19 +2992,19 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_10) { //x.printIndexedBuffer("Images"); //x.printBuffer("Images linear"); auto result = op.evaluate({&x}, {}, {3,3, 1,1, 1,1, 0}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="VALID" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("OutputValid"); // exp.printBuffer("ExpectValid"); // for (Nd4jLong e = 0; e < exp.lengthOf(); e++) // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_010) { auto x = NDArrayFactory::create('c', {1, 4, 4, 1}); @@ -3021,19 +3021,19 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_010) { //x.printIndexedBuffer("Images"); //x.printBuffer("Images linear"); auto result = op.evaluate({&x}, {}, {2,2, 1,1, 1,1, 0}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="VALID" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("OutputValid"); // exp.printBuffer("ExpectValid"); // for (Nd4jLong e = 0; e < exp.lengthOf(); e++) // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_010_1) { auto x = NDArrayFactory::create('c', {1, 4, 4, 1}); @@ -3051,8 +3051,8 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_010_1) { //x.printIndexedBuffer("Images"); //x.printBuffer("Images linear"); auto result = op.evaluate({&x}, {}, {2,2, 1,1, 1,1, 1}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="VALID" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("OutputSame"); // exp.printBuffer("ExpectSame"); // exp.printIndexedBuffer("Expect Same Formatted"); @@ -3061,11 +3061,11 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_010_1) { // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_011) { @@ -3083,19 +3083,19 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_011) { //x.printIndexedBuffer("Images"); //x.printBuffer("Images linear"); auto result = op.evaluate({&x}, {}, {2,2, 1,1, 2,2, 0}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="VALID" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("OutputValid"); // exp.printBuffer("ExpectValid"); // for (Nd4jLong e = 0; e < exp.lengthOf(); e++) // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3119,19 +3119,19 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_11) { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,2, 2,2, 1,1, 1}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="SAME" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); // output->printBuffer("Output"); // exp.printBuffer("Expect"); // for (Nd4jLong e = 0; e < exp.lengthOf(); e++) // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3176,8 +3176,8 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_12) { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,2, 1,1, 2,2, 1}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,2,2,1], padding="SAME" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); //output->printShapeInfo("Output shape"); // output->printIndexedBuffer("Output"); // exp.printBuffer("Expect"); @@ -3185,11 +3185,11 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_12) { // if (exp.e(e) != output->e(e)) // printf("%lld ", e); // printf("\n"); - //result->at(1)->printBuffer("OUtput2"); + //result.at(1)->printBuffer("OUtput2"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3206,13 +3206,13 @@ TEST_F(DeclarableOpsTests7, TestExtractImagePatches_SGO_13) { sd::ops::extract_image_patches op; auto result = op.evaluate({&x}, {}, {2,2, 1,1, 1,1, 1}); // equiv TF ksizes=[1,2,2,1], strides=[1,1,1,1], rates=[1,1,1,1], padding="SAME" - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3231,11 +3231,11 @@ auto exp = NDArrayFactory::create('c', {2, 2, 4, 2}, { sd::ops::roll op; auto result = op.evaluate({&x}, {}, {6}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3253,10 +3253,10 @@ auto exp = NDArrayFactory::create('c', {2, 2, 4, 2}, { sd::ops::roll op; auto result = op.evaluate({&x}, {}, {-8}); - ASSERT_EQ(result->status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_EQ(result.status(), Status::OK()); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3274,11 +3274,11 @@ auto exp = NDArrayFactory::create('c', {2, 2, 4, 2}, { sd::ops::roll op; auto result = op.evaluate({&x}, {}, {-40}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3297,13 +3297,13 @@ auto exp = NDArrayFactory::create('c', {2, 2, 4, 2}, { sd::ops::roll op; auto result = op.evaluate({&x}, {}, {38}); - ASSERT_EQ(result->status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output 4"); + ASSERT_EQ(result.status(), Status::OK()); + //result.at(0)->printIndexedBuffer("Output 4"); //exp.printIndexedBuffer("Expect 4"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3328,7 +3328,7 @@ auto exp = NDArrayFactory::create('c', {2, 2, 4, 2}, { ASSERT_TRUE(exp.equalsTo(&x)); -// delete result; +// } //////////////////////////////////////////////////////////////////////////////// @@ -3345,14 +3345,14 @@ auto exp = NDArrayFactory::create('c', {3, 4}, { sd::ops::roll op; auto result = op.evaluate({&x}, {}, {2, 1}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); + //result.at(0)->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expect"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3368,14 +3368,14 @@ auto exp = NDArrayFactory::create('c', {2, 3, 2}, { sd::ops::roll op; auto result = op.evaluate({&x}, {}, {1, 2}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); + //result.at(0)->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expect"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3391,14 +3391,14 @@ auto exp = NDArrayFactory::create('c', {2, 3, 2}, { sd::ops::roll op; auto result = op.evaluate({&x}, {}, {1, 2, 1, 0}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - //result->at(0)->printIndexedBuffer("Output"); + //result.at(0)->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expect"); - ASSERT_TRUE(exp.equalsTo(result->at(0))); + ASSERT_TRUE(exp.equalsTo(result.at(0))); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3421,7 +3421,7 @@ auto exp = NDArrayFactory::create('c', {2, 3, 2}, { ASSERT_TRUE(exp.equalsTo(&x)); -// delete result; +// } //////////////////////////////////////////////////////////////////////////////// @@ -3441,7 +3441,7 @@ auto exp = NDArrayFactory::create('c', {2, 3, 3}, { ASSERT_TRUE(exp.equalsTo(&x)); -// delete result; +// } //////////////////////////////////////////////////////////////////////////////// @@ -3456,15 +3456,15 @@ TEST_F(DeclarableOpsTests7, TestRoll_10) { // ---------------------------------------------------------------- sd::ops::roll op; auto result = op.evaluate({&x}, {}, {3, 1}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); // out->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expect"); ASSERT_TRUE(exp.equalsTo(out)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3481,15 +3481,15 @@ TEST_F(DeclarableOpsTests7, TestRoll_11) { sd::ops::roll op; NDArray* y = nullptr; auto result = op.evaluate({&x, &shift, &axis}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); // out->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expect"); ASSERT_TRUE(exp.equalsTo(out)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3507,12 +3507,12 @@ TEST_F(DeclarableOpsTests7, TestRoll_12) { sd::ops::roll op; NDArray* y = nullptr; auto result = op.evaluate({&x, &shift, &axis}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); ASSERT_TRUE(exp.equalsTo(out)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3530,12 +3530,12 @@ TEST_F(DeclarableOpsTests7, TestRoll_13) { sd::ops::roll op; NDArray* y = nullptr; auto result = op.evaluate({&x}, {}, {3,2}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); ASSERT_TRUE(exp.equalsTo(out)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3553,14 +3553,14 @@ TEST_F(DeclarableOpsTests7, TestRoll_14) { sd::ops::roll op; auto result = op.evaluate({&x, &shift, &axis}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); // out->printIndexedBuffer("Output"); //exp.printIndexedBuffer("Expect"); ASSERT_TRUE(exp.equalsTo(out)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3574,14 +3574,14 @@ TEST_F(DeclarableOpsTests7, TestRoll_15) { sd::ops::roll op; auto result = op.evaluate({&x, &shift, &axis}); - ASSERT_EQ(result->status(), Status::OK()); - auto out = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto out = result.at(0); // out->printIndexedBuffer("Output 15"); // exp.printIndexedBuffer("Expect 15"); ASSERT_TRUE(exp.equalsTo(out)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3599,12 +3599,12 @@ TEST_F(DeclarableOpsTests7, percentile_test1) { sd::ops::percentile op; auto result = op.evaluate({&input}, {50.}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } @@ -3623,12 +3623,12 @@ TEST_F(DeclarableOpsTests7, percentile_test2) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 2, 1}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } @@ -3647,12 +3647,12 @@ TEST_F(DeclarableOpsTests7, percentile_test3) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 0, 1}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } @@ -3671,12 +3671,12 @@ TEST_F(DeclarableOpsTests7, percentile_test4) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 1, 1}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3695,12 +3695,12 @@ TEST_F(DeclarableOpsTests7, percentile_test5) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 0, 1}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3719,12 +3719,12 @@ TEST_F(DeclarableOpsTests7, percentile_test6) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 1, 1}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3743,12 +3743,12 @@ TEST_F(DeclarableOpsTests7, percentile_test7) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 2, 1}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3767,12 +3767,12 @@ TEST_F(DeclarableOpsTests7, percentile_test8) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 2, 0}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3791,12 +3791,12 @@ TEST_F(DeclarableOpsTests7, percentile_test9) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 2, 0}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3815,12 +3815,12 @@ TEST_F(DeclarableOpsTests7, percentile_test10) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 2, 1}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3835,12 +3835,12 @@ TEST_F(DeclarableOpsTests7, percentile_test11) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 2, 1}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3855,12 +3855,12 @@ TEST_F(DeclarableOpsTests7, percentile_test12) { sd::ops::percentile op; //q, interpolation, keepDims auto result = op.evaluate({&input}, {10, 2, 0}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3871,12 +3871,12 @@ TEST_F(DeclarableOpsTests7, transpose_test3) { sd::ops::transpose op; auto result = op.evaluate({&input}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3887,12 +3887,12 @@ TEST_F(DeclarableOpsTests7, rationaltanh_test1) { sd::ops::rationaltanh op; auto result = op.evaluate({&input}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Output rationaltanh"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3903,12 +3903,12 @@ TEST_F(DeclarableOpsTests7, rationaltanh_test2) { sd::ops::rationaltanh op; auto result = op.evaluate({&input}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Output rationaltanh"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3920,12 +3920,12 @@ TEST_F(DeclarableOpsTests7, rationaltanh_test3) { sd::ops::rationaltanh_bp op; auto result = op.evaluate({&input, &eps}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printBuffer("Output rationaltanh BP"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3936,12 +3936,12 @@ TEST_F(DeclarableOpsTests7, rectifiedtanh_test1) { sd::ops::rectifiedtanh op; auto result = op.evaluate({&input}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Output rectifiedtanh"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3953,12 +3953,12 @@ TEST_F(DeclarableOpsTests7, rectifiedtanh_test2) { sd::ops::rectifiedtanh_bp op; auto result = op.evaluate({&input, &eps}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printBuffer("Output rectifiedtanh BP"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests7, RealDiv_1) { @@ -3970,14 +3970,14 @@ TEST_F(DeclarableOpsTests7, RealDiv_1) { sd::ops::realdiv op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("OUtput RealDiv"); ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3992,10 +3992,10 @@ TEST_F(DeclarableOpsTests7, RealDiv_BP_1) { sd::ops::realdiv_bp op; auto result = op.evaluate({&x, &y, &eps}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z0 = result->at(0); - auto z1 = result->at(1); + auto z0 = result.at(0); + auto z1 = result.at(1); // z0->printShapeInfo("OUtput RealDiv BP0 shape"); // z1->printShapeInfo("OUtput RealDiv BP1 shape"); // z0->printIndexedBuffer("OUtput RealDiv BP0"); @@ -4004,7 +4004,7 @@ TEST_F(DeclarableOpsTests7, RealDiv_BP_1) { ASSERT_TRUE(e0.equalsTo(z0)); ASSERT_TRUE(e1.equalsTo(z1)); - delete result; + } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -4017,14 +4017,14 @@ TEST_F(DeclarableOpsTests7, ShapesOf_1) { sd::ops::shapes_of op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("OUtput RealDiv"); // ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -4038,17 +4038,17 @@ TEST_F(DeclarableOpsTests7, ShapesOf_2) { sd::ops::shapes_of op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z0 = result->at(0); - auto z1 = result->at(1); + auto z0 = result.at(0); + auto z1 = result.at(1); // z0->printIndexedBuffer("OUtput shapes2"); // z1->printIndexedBuffer("OUtput shapes2"); // ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e0.equalsTo(z0)); ASSERT_TRUE(e1.equalsTo(z1)); - delete result; + } TEST_F(DeclarableOpsTests7, Size_1) { @@ -4060,14 +4060,14 @@ TEST_F(DeclarableOpsTests7, Size_1) { sd::ops::size op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("OUtput SIZE"); /// ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; + } TEST_F(DeclarableOpsTests7, Size_2) { @@ -4079,14 +4079,14 @@ TEST_F(DeclarableOpsTests7, Size_2) { sd::ops::size op; auto result = op.evaluate({&y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("OUtput SIZE"); /// ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; + } TEST_F(DeclarableOpsTests7, Softplus_1) { @@ -4097,14 +4097,14 @@ TEST_F(DeclarableOpsTests7, Softplus_1) { sd::ops::softplus op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("OUtput Softplus"); /// ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; + } TEST_F(DeclarableOpsTests7, Softplus_BP_1) { @@ -4121,12 +4121,12 @@ TEST_F(DeclarableOpsTests7, Softplus_BP_1) { ASSERT_TRUE(gradOK); // -// auto z = result->at(0); +// auto z = result.at(0); // z->printIndexedBuffer("OUtput Softplus"); ///// ASSERT_TRUE(e.isSameShape(z)); // ASSERT_TRUE(e.equalsTo(*z)); // -// delete result; +// } TEST_F(DeclarableOpsTests7, Softsign_1) { @@ -4137,14 +4137,14 @@ TEST_F(DeclarableOpsTests7, Softsign_1) { sd::ops::softsign op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("OUtput Softsign"); /// ASSERT_TRUE(e.isSameShape(z)); ASSERT_TRUE(e.equalsTo(*z)); - delete result; + } TEST_F(DeclarableOpsTests7, Softsign_BP_1) { @@ -4172,14 +4172,14 @@ TEST_F(DeclarableOpsTests7, fill_test2) { sd::ops::fill op; auto result = op.evaluate({&x, &v}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4191,14 +4191,14 @@ TEST_F(DeclarableOpsTests7, fill_test3) { sd::ops::fill op; auto result = op.evaluate({&x, &v}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4209,14 +4209,14 @@ TEST_F(DeclarableOpsTests7, ToggleBits_test1) { sd::ops::toggle_bits op; auto result = op.evaluate({&x}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); // output->printIndexedBuffer("Toggled"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4229,17 +4229,17 @@ TEST_F(DeclarableOpsTests7, ToggleBits_test2) { sd::ops::toggle_bits op; auto result = op.evaluate({&x, &y}); - auto output = result->at(0); - auto z = result->at(1); + auto output = result.at(0); + auto z = result.at(1); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); // output->printIndexedBuffer("Toggled"); ASSERT_TRUE(exp0.isSameShape(output)); ASSERT_TRUE(exp0.equalsTo(output)); ASSERT_TRUE(exp1.isSameShape(z)); ASSERT_TRUE(exp1.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4250,12 +4250,12 @@ TEST_F(DeclarableOpsTests7, Truncatediv_test1) { sd::ops::truncatediv op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); // output->printIndexedBuffer("Toggled"); ASSERT_TRUE(exp.isSameShape(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4266,12 +4266,12 @@ TEST_F(DeclarableOpsTests7, Truncatediv_test2) { sd::ops::truncatediv op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); // output->printIndexedBuffer("Toggled"); ASSERT_TRUE(exp.isSameShape(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4287,19 +4287,17 @@ TEST_F(DeclarableOpsTests7, TypesConversion_test1) { auto result32 = op32.evaluate({&x}, {}, {}); auto result64 = op64.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result32->status()); - ASSERT_EQ(ND4J_STATUS_OK, result64->status()); - auto out1 = result32->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result32.status()); + ASSERT_EQ(ND4J_STATUS_OK, result64.status()); + auto out1 = result32.at(0); // out1->printIndexedBuffer("OUT_I"); - auto out2 = result64->at(0); + auto out2 = result64.at(0); // out2->printIndexedBuffer("OUT_L"); // output->printIndexedBuffer("Toggled"); ASSERT_TRUE(expI.equalsTo(out1)); ASSERT_TRUE(expL.equalsTo(out2)); - delete result32; - delete result64; } //////////////////////////////////////////////////////////////////////////////// @@ -4313,19 +4311,17 @@ TEST_F(DeclarableOpsTests7, TypesConversion_test2) { auto result32 = op32.evaluate({&x}, {}, {}); auto result16 = op16.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result32->status()); - ASSERT_EQ(ND4J_STATUS_OK, result16->status()); - auto out1 = result32->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result32.status()); + ASSERT_EQ(ND4J_STATUS_OK, result16.status()); + auto out1 = result32.at(0); // out1->printIndexedBuffer("OUT_F"); - auto out2 = result16->at(0); + auto out2 = result16.at(0); // out2->printIndexedBuffer("OUT_H"); // output->printIndexedBuffer("Toggled"); ASSERT_TRUE(expF.equalsTo(out1)); ASSERT_TRUE(expH.equalsTo(out2)); - delete result32; - delete result16; } //////////////////////////////////////////////////////////////////////////////// @@ -4339,19 +4335,16 @@ TEST_F(DeclarableOpsTests7, TypesConversion_test3) { auto result32 = op32.evaluate({&x}, {}, {}); auto result64 = op64.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result32->status()); - ASSERT_EQ(ND4J_STATUS_OK, result64->status()); - auto out1 = result32->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result32.status()); + ASSERT_EQ(ND4J_STATUS_OK, result64.status()); + auto out1 = result32.at(0); // out1->printIndexedBuffer("OUT_U32"); - auto out2 = result64->at(0); + auto out2 = result64.at(0); // out2->printIndexedBuffer("OUT_U64"); // output->printIndexedBuffer("Toggled"); ASSERT_TRUE(exp32.equalsTo(out1)); ASSERT_TRUE(exp64.equalsTo(out2)); - - delete result32; - delete result64; } //////////////////////////////////////////////////////////////////////////////// @@ -4365,16 +4358,14 @@ TEST_F(DeclarableOpsTests7, TypesConversion_test4) { auto result32 = op32.evaluate({&x}, {}, {}); auto result64 = op64.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result32->status()); - ASSERT_EQ(ND4J_STATUS_OK, result64->status()); - auto out1 = result32->at(0); - auto out2 = result64->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result32.status()); + ASSERT_EQ(ND4J_STATUS_OK, result64.status()); + auto out1 = result32.at(0); + auto out2 = result64.at(0); ASSERT_TRUE(exp32.equalsTo(out1)); ASSERT_TRUE(exp64.equalsTo(out2)); - delete result32; - delete result64; } //////////////////////////////////////////////////////////////////////////////// @@ -4387,12 +4378,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test1) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4405,12 +4396,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test2) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4423,12 +4414,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test3) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4441,12 +4432,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test4) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4459,11 +4450,11 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test5) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4476,12 +4467,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test6) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4494,12 +4485,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test7) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4512,13 +4503,13 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test8) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - ASSERT_EQ(result->status(), Status::OK()); + ASSERT_EQ(result.status(), Status::OK()); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4531,12 +4522,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test9) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4549,12 +4540,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test10) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4567,12 +4558,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test11) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4585,12 +4576,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test12) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4603,12 +4594,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test13) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4621,12 +4612,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test14) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4639,12 +4630,12 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test15) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4662,15 +4653,15 @@ TEST_F(DeclarableOpsTests7, mirrorPad_test16) { sd::ops::mirror_pad op; auto result = op.evaluate({&input, &paddings}, {}, {0}); - ASSERT_EQ(result->status(), Status::OK()); - auto output = result->at(0); + ASSERT_EQ(result.status(), Status::OK()); + auto output = result.at(0); //output->printBuffer("VVV"); //exp.printBuffer("EXP"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4683,11 +4674,11 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_1) { sd::ops::reduce_sum op; auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); //z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4700,11 +4691,11 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_2) { sd::ops::reduce_sum op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4717,11 +4708,11 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_1) { sd::ops::reduce_prod op; auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); //z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4734,11 +4725,11 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_2) { sd::ops::reduce_prod op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4750,14 +4741,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_01) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4769,15 +4760,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_02) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4789,15 +4780,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_3) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4809,15 +4800,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_4) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4829,15 +4820,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_5) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4849,15 +4840,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_6) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4869,15 +4860,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4889,14 +4880,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_01) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4908,15 +4899,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_02) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4928,15 +4919,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_3) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4948,15 +4939,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_4) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4968,15 +4959,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_5) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -4988,15 +4979,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_6) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5008,15 +4999,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TYPED_TEST(TypedDeclarableOpsTests7, Test_Pnorm_Once_Again) { @@ -5025,11 +5016,11 @@ TYPED_TEST(TypedDeclarableOpsTests7, Test_Pnorm_Once_Again) { sd::ops::pnormpool2d op; auto result = op.evaluate({&input}, {}, {1,1, 1,1, 0,0, 1,1,1, 3, 0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(exp, *result->at(0)); + ASSERT_EQ(exp, *result.at(0)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5041,14 +5032,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_1) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5060,15 +5051,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_2) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5080,15 +5071,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_3) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5100,15 +5091,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_4) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5120,15 +5111,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_5) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5140,15 +5131,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_6) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5160,15 +5151,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_min op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5180,15 +5171,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_1) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); // output->printShapeInfo("Output shape"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5200,15 +5191,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_2) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5220,15 +5211,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_3) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5240,15 +5231,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_4) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5260,15 +5251,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_5) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5280,15 +5271,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_6) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5300,15 +5291,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_max op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5320,14 +5311,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_1) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5339,15 +5330,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_2) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5359,15 +5350,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_3) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5379,15 +5370,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_4) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5399,15 +5390,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_5) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5419,15 +5410,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_6) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5439,15 +5430,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_1) { @@ -5458,14 +5449,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_1) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5477,15 +5468,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_2) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5497,15 +5488,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_3) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5517,15 +5508,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_4) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5537,15 +5528,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_5) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5557,15 +5548,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_6) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5577,15 +5568,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5597,14 +5588,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_1) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5616,14 +5607,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_2) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {1.f}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5635,14 +5626,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_3) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5654,14 +5645,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_4) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {1.f}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5673,15 +5664,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_5) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5693,15 +5684,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_6) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {}, {0, 1, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5713,15 +5704,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_7) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {1.f}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5733,14 +5724,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_1) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5752,14 +5743,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_2) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {1.f}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5771,14 +5762,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_3) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5790,14 +5781,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_4) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {1.f}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5809,15 +5800,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_5) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5829,15 +5820,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_6) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {}, {0, 1, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5849,15 +5840,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_7) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {1.f}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5871,12 +5862,12 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_BP_1) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5892,12 +5883,12 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_BP_2) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps}, {1.f}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5913,12 +5904,12 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_BP_3) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5934,12 +5925,12 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Sum_BP_4) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps}, {1.f}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5959,12 +5950,12 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_BP_1) { sd::ops::reduce_prod_bp op; auto result = op.evaluate({&input, &eps}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -5981,17 +5972,17 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_BP_2) { sd::ops::reduce_prod op_exp; auto res = op_exp.evaluate({&input}); auto result = op.evaluate({&input, &eps}, {}, {}); - exp.assign(res->at(0)->e(0)); + exp.assign(res.at(0)->e(0)); exp /= input; exp *= eps.e(0); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); //z->printIndexedBuffer("Result is "); //exp.printIndexedBuffer("Expected"); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; - delete res; + + } //////////////////////////////////////////////////////////////////////////////// @@ -6006,13 +5997,13 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_BP_3) { //sd::ops::reduce_prod op_exp; auto result = op.evaluate({&input, &eps}, {1.f}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // exp.printIndexedBuffer("Expected"); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6027,13 +6018,13 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_BP_03) { //sd::ops::reduce_prod op_exp; auto result = op.evaluate({&input, &eps, &axis}, {}, {}, {true}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // exp.printIndexedBuffer("Expected"); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6049,14 +6040,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_BP_4) { // auto res = op_exp.execute({&input}, {}, {}); auto result = op.evaluate({&input, &eps}, {0.f}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // exp.printIndexedBuffer("Expected"); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; -// delete res; + +// } //////////////////////////////////////////////////////////////////////////////// @@ -6072,14 +6063,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Prod_BP_5) { // auto res = op_exp.execute({&input}, {}, {}); auto result = op.evaluate({&input, &eps}, {0.f}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // exp.printIndexedBuffer("Expected"); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; -// delete res; + +// } //////////////////////////////////////////////////////////////////////////////// @@ -6097,14 +6088,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_BP_1) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_min_bp op; auto result = op.evaluate({&x, &eps}, {}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6122,14 +6113,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_BP_2) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_min_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, Test_Reduce_Min_BP_02) { @@ -6147,14 +6138,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_BP_02) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_min_bp op; auto result = op.evaluate({&x, &eps, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6170,14 +6161,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_BP_3) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_min_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6193,14 +6184,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_BP_4) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_min_bp op; auto result = op.evaluate({&x, &eps}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6223,14 +6214,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_BP_5) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_min_bp op; auto result = op.evaluate({&x, &eps}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6253,14 +6244,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Min_BP_6) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_min_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6278,13 +6269,13 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_BP_1) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_max_bp op; auto result = op.evaluate({&x, &eps}, {}, {0, 1}); - auto output = result->at(0); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + auto output = result.at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6302,14 +6293,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_BP_2) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_max_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6328,14 +6319,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_BP_02) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_max_bp op; auto result = op.evaluate({&x, &eps, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6357,14 +6348,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_BP_3) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_max_bp op; auto result = op.evaluate({&x, &eps}, {}, {0}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6387,14 +6378,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Max_BP_4) { // exp.printIndexedBuffer("Expected "); sd::ops::reduce_max_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6411,14 +6402,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_BP_1) { exp.p(20, -exp.e(20)); sd::ops::reduce_norm1_bp op; auto result = op.evaluate({&x, &eps}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6430,14 +6421,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_BP_2) { auto exp = NDArrayFactory::create('c', {2, 3, 4}, {1.f, 2.f, 3.f, 4.f, 1.f, 2.f, 3.f, 4.f, 1.f, 2.f, 3.f, 4.f, 1.f, 2.f, 3.f, 4.f,1.f, 2.f, 3.f, 4.f,1.f, 2.f, 3.f, 4.f}); sd::ops::reduce_norm1_bp op; auto result = op.evaluate({&x, &eps}, {}, {0,1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); // exp.printIndexedBuffer("Expect is"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6450,12 +6441,12 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_BP_02) { auto axes = NDArrayFactory::create({0,1}); sd::ops::reduce_norm1_bp op; auto result = op.evaluate({&x, &eps, &axes}, {}, {}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6467,13 +6458,13 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm1_BP_3) { auto exp = NDArrayFactory::create('c', {2, 3, 4}, {1.f, 2.f, 3.f, 4.f, 1.f, 2.f, 3.f, 4.f, 1.f, 2.f, 3.f, 4.f, 1.f, 2.f, 3.f, 4.f,1.f, 2.f, 3.f, 4.f,1.f, 2.f, 3.f, 4.f}); sd::ops::reduce_norm1_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0,1}); - auto output = result->at(0); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + auto output = result.at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6485,14 +6476,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_BP_1) { sd::ops::reduce_norm2_bp op; auto result = op.evaluate({&x, &eps}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(x.isSameShape(output)); ASSERT_TRUE(x.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6504,14 +6495,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_BP_2) { sd::ops::reduce_norm2_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(x.isSameShape(output)); ASSERT_TRUE(x.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6524,14 +6515,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_BP_02) { sd::ops::reduce_norm2_bp op; auto result = op.evaluate({&x, &eps, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(x.isSameShape(output)); ASSERT_TRUE(x.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6543,15 +6534,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_BP_3) { sd::ops::reduce_norm2_bp op; auto result = op.evaluate({&x, &eps}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(x.isSameShape(output)); ASSERT_TRUE(x.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6563,15 +6554,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Norm2_BP_4) { sd::ops::reduce_norm2_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(x.isSameShape(output)); ASSERT_TRUE(x.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6590,13 +6581,13 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_BP_1) { sd::ops::reduce_sqnorm_bp op; auto result = op.evaluate({&x, &eps}, {}, {0,1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6616,13 +6607,13 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_SquaredNorm_BP_01) { sd::ops::reduce_sqnorm_bp op; auto result = op.evaluate({&x, &eps, &axes}, {}, {}, {false}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6639,14 +6630,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_1) { sd::ops::reduce_norm_max_bp op; auto result = op.evaluate({&x, &eps}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6663,14 +6654,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_2) { sd::ops::reduce_norm_max_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6688,14 +6679,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_02) { sd::ops::reduce_norm_max_bp op; auto result = op.evaluate({&x, &eps, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_3) { @@ -6711,14 +6702,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_3) { sd::ops::reduce_norm_max_bp op; auto result = op.evaluate({&x, &eps}, {}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6733,14 +6724,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_4) { exp.p(23, 3.f); sd::ops::reduce_norm_max_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6753,15 +6744,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_5) { exp.p(23, 1.f); sd::ops::reduce_norm_max_bp op; auto result = op.evaluate({&x, &eps}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6775,15 +6766,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_6) { sd::ops::reduce_norm_max_bp op; auto result = op.evaluate({&x, &eps}, {}, {0, 1, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6796,15 +6787,15 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_NormMax_BP_7) { exp.p(23, 1.f); sd::ops::reduce_norm_max_bp op; auto result = op.evaluate({&x, &eps}, {1.f}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6821,16 +6812,16 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Dot_BP_1) { sd::ops::reduce_dot_bp op; auto result = op.evaluate({&x, &y, &eps}, {}, {}); - auto output = result->at(0); - auto outputX = result->at(1); + auto output = result.at(0); + auto outputX = result.at(1); //tput->printIndexedBuffer("Result is"); -// ASSERT_EQ(ND4J_STATUS_OK, result->status()); +// ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(x.equalsTo(outputX)); ASSERT_TRUE(y.equalsTo(output)); - delete result; + // delete z; } @@ -6852,16 +6843,16 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Dot_BP_2) { y.assign(2.f); sd::ops::reduce_dot_bp op; auto result = op.evaluate({&x, &y, &eps}, {}, {1}); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - ASSERT_EQ(result->size(), 2); - auto outputX = result->at(0); - auto outputY = result->at(1); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + ASSERT_EQ(result.size(), 2); + auto outputX = result.at(0); + auto outputY = result.at(1); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(expX.equalsTo(outputX)); ASSERT_TRUE(expY.equalsTo(outputY)); - delete result; + // delete z; } @@ -6884,16 +6875,16 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Dot_BP_02) { y.assign(2.f); sd::ops::reduce_dot_bp op; auto result = op.evaluate({&x, &y, &eps, &axis}, {}, {}, {false}); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - ASSERT_EQ(result->size(), 2); - auto outputX = result->at(0); - auto outputY = result->at(1); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + ASSERT_EQ(result.size(), 2); + auto outputX = result.at(0); + auto outputY = result.at(1); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(expX.equalsTo(outputX)); ASSERT_TRUE(expY.equalsTo(outputY)); - delete result; + // delete z; } @@ -6911,14 +6902,14 @@ TEST_F(DeclarableOpsTests7, Test_Reduce_Dot_BP_3) { sd::ops::reduce_dot_bp op; auto result = op.evaluate({&x,&y, &eps}, {}, {1}); - auto outputX = result->at(0); - auto outputY = result->at(1); + auto outputX = result.at(0); + auto outputY = result.at(1); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(expX.equalsTo(outputX)); ASSERT_TRUE(expY.equalsTo(outputY)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6933,14 +6924,14 @@ TEST_F(DeclarableOpsTests7, cumsum_bp_1) { sd::ops::cumsum_bp op; auto result = op.evaluate({&x, &eps}, {}, {0,0}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6955,14 +6946,14 @@ TEST_F(DeclarableOpsTests7, cumsum_bp_2) { sd::ops::cumsum_bp op; auto result = op.evaluate({&x, &eps}, {}, {1,0}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -6977,12 +6968,12 @@ TEST_F(DeclarableOpsTests7, cumsum_bp_3) { sd::ops::cumsum_bp op; auto result = op.evaluate({&x, &eps}, {}, {1,1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests8.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests8.cpp index 17158de2a..276c74e78 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests8.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests8.cpp @@ -58,14 +58,14 @@ TEST_F(DeclarableOpsTests8, reduceVariance_test1) { sd::ops::reduce_variance op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -76,14 +76,14 @@ TEST_F(DeclarableOpsTests8, reduceVariance_test2) { sd::ops::reduce_variance op; auto result = op.evaluate({&x}, {1.}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -94,14 +94,14 @@ TEST_F(DeclarableOpsTests8, reduceVariance_test3) { sd::ops::reduce_variance op; auto result = op.evaluate({&x}, {}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -112,14 +112,14 @@ TEST_F(DeclarableOpsTests8, reduceVariance_test4) { sd::ops::reduce_variance op; auto result = op.evaluate({&x}, {1.}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -130,14 +130,14 @@ TEST_F(DeclarableOpsTests8, reduceVariance_test5) { sd::ops::reduce_variance op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -148,14 +148,14 @@ TEST_F(DeclarableOpsTests8, reduceVariance_test6) { sd::ops::reduce_variance op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -166,14 +166,14 @@ TEST_F(DeclarableOpsTests8, reduceVariance_test7) { sd::ops::reduce_variance op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -184,14 +184,14 @@ TEST_F(DeclarableOpsTests8, reduceVariance_test8) { auto axes = NDArrayFactory::create({0, 1, 2}); sd::ops::reduce_variance op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -202,14 +202,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test1) { sd::ops::reduce_stdev op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -220,14 +220,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test2) { sd::ops::reduce_stdev op; auto result = op.evaluate({&x}, {1.}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -238,14 +238,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test3) { sd::ops::reduce_stdev op; auto result = op.evaluate({&x}, {}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -256,14 +256,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test4) { sd::ops::reduce_stdev op; auto result = op.evaluate({&x}, {1.}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -274,14 +274,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test5) { sd::ops::reduce_stdev op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -292,14 +292,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test6) { sd::ops::reduce_stdev op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -310,14 +310,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test7) { sd::ops::reduce_stdev op; auto result = op.evaluate({&x}, {1.f}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -328,14 +328,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test8) { sd::ops::reduce_stdev op; auto result = op.evaluate({&x}, {0.f,1.f}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); // output->printBuffer("Reduced STDDEV"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -346,14 +346,14 @@ TEST_F(DeclarableOpsTests8, reduceStDev_test08) { auto axes = NDArrayFactory::create({0,1}); sd::ops::reduce_stdev op; auto result = op.evaluate({&x, &axes}, {}, {}, {false, true}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); // output->printBuffer("Reduced STDDEV08"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -370,32 +370,32 @@ TEST_F(DeclarableOpsTests8, reduceVarianceBP_test1) { sd::ops::reduce_variance_bp op; auto result = op.evaluate({&x, &gradO2}, {0,1}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,1}, {}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {0,0}, {}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,0}, {}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + } @@ -413,32 +413,32 @@ TEST_F(DeclarableOpsTests8, reduceVarianceBP_test2) { sd::ops::reduce_variance_bp op; auto result = op.evaluate({&x, &gradO2}, {0,0}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,0}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {0,1}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,1}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + } @@ -456,32 +456,32 @@ TEST_F(DeclarableOpsTests8, reduceVarianceBP_test02) { sd::ops::reduce_variance_bp op; auto result = op.evaluate({&x, &gradO2, &axes}, {}, {}, {false, false}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1, &axes}, {}, {}, {true, false}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2, &axes}, {}, {}, {false, true}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1, &axes}, {}, {}, {true, true}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + } @@ -503,32 +503,32 @@ TEST_F(DeclarableOpsTests8, reduceVarianceBP_test3) { sd::ops::reduce_variance_bp op; auto result = op.evaluate({&x, &gradO2}, {0, 0}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1, 0}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {0, 1}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1, 1}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -545,33 +545,33 @@ TEST_F(DeclarableOpsTests8, reduceStDevBP_test1) { sd::ops::reduce_stdev_bp op; auto result = op.evaluate({&x, &gradO2}, {0,1}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); // output->printIndexedBuffer(); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,1}, {}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {0,0}, {}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,0}, {}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -588,32 +588,32 @@ TEST_F(DeclarableOpsTests8, reduceStDevBP_test2) { sd::ops::reduce_stdev_bp op; auto result = op.evaluate({&x, &gradO2}, {0,0}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,0}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {0,1}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,1}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -631,32 +631,32 @@ TEST_F(DeclarableOpsTests8, reduceStDevBP_test02) { sd::ops::reduce_stdev_bp op; auto result = op.evaluate({&x, &gradO2, &axis}, {}, {}, {false, false}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1, &axis}, {}, {}, {true, false}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2, &axis}, {}, {}, {false, true}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1, &axis}, {}, {}, {true, true}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -673,32 +673,32 @@ TEST_F(DeclarableOpsTests8, reduceStDevBP_test3) { sd::ops::reduce_stdev_bp op; auto result = op.evaluate({&x, &gradO2}, {0,0}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,0}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp12.isSameShape(output)); ASSERT_TRUE(exp12.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {0,1}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,1}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp34.isSameShape(output)); ASSERT_TRUE(exp34.equalsTo(output)); - delete result; + } @@ -713,11 +713,11 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_1) { sd::ops::reduce_sum op; auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); //z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -730,11 +730,11 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_2) { sd::ops::reduce_sum op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -748,11 +748,11 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_03) { sd::ops::reduce_sum op; auto result = op.evaluate({&input, &axis}, {}, {}, {false}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -765,11 +765,11 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_1) { sd::ops::reduce_prod op; auto result = op.evaluate({&input}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); //z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -782,11 +782,11 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_2) { sd::ops::reduce_prod op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -798,14 +798,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_01) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -817,15 +817,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_02) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -837,15 +837,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_3) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -857,15 +857,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_4) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -877,15 +877,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_5) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -897,15 +897,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_6) { sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -917,15 +917,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_sum op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -937,14 +937,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_01) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -956,15 +956,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_02) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -976,15 +976,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_3) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -996,15 +996,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_4) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1017,15 +1017,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_04) { sd::ops::reduce_prod op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1037,15 +1037,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_5) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1057,15 +1057,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_6) { sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1077,15 +1077,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_prod op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1097,14 +1097,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Min_1) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1116,15 +1116,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Min_2) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1136,15 +1136,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Min_3) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1156,15 +1156,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Min_4) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1177,15 +1177,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Min_04) { sd::ops::reduce_min op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1197,15 +1197,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Min_5) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1217,15 +1217,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Min_6) { sd::ops::reduce_min op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1237,15 +1237,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Min_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_min op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1257,15 +1257,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Max_1) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); // output->printShapeInfo("Output shape"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1277,15 +1277,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Max_2) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1297,15 +1297,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Max_3) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1317,15 +1317,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Max_4) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1338,15 +1338,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Max_04) { sd::ops::reduce_max op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1358,15 +1358,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Max_5) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1378,15 +1378,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Max_6) { sd::ops::reduce_max op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1398,15 +1398,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Max_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_max op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_1) { @@ -1417,14 +1417,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_1) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1436,15 +1436,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_2) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1456,15 +1456,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_3) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1476,15 +1476,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_4) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1497,15 +1497,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_04) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1517,15 +1517,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_5) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1537,15 +1537,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_6) { sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1557,15 +1557,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm1_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_norm1 op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_1) { @@ -1576,14 +1576,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_1) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1595,15 +1595,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_2) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1615,15 +1615,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_3) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1635,15 +1635,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_4) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1656,15 +1656,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_04) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1676,15 +1676,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_5) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1696,15 +1696,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_6) { sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1716,15 +1716,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Norm2_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::reduce_norm2 op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1736,14 +1736,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_NormMax_1) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1755,14 +1755,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_NormMax_2) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {1.f}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1774,14 +1774,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_NormMax_3) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1793,14 +1793,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_NormMax_4) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {1.f}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1813,14 +1813,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_NormMax_04) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1832,15 +1832,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_NormMax_5) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1852,15 +1852,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_NormMax_6) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {}, {0, 1, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1872,15 +1872,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_NormMax_7) { sd::ops::reduce_norm_max op; auto result = op.evaluate({&x}, {1.f}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1892,14 +1892,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_SquaredNorm_1) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1911,14 +1911,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_SquaredNorm_2) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {1.f}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1930,14 +1930,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_SquaredNorm_3) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1949,14 +1949,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_SquaredNorm_4) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {1.f}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1969,14 +1969,14 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_SquaredNorm_04) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1988,15 +1988,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_SquaredNorm_5) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2008,15 +2008,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_SquaredNorm_6) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {}, {0, 1, 2}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2028,15 +2028,15 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_SquaredNorm_7) { sd::ops::reduce_sqnorm op; auto result = op.evaluate({&x}, {1.f}, {}); - auto output = result->at(0); + auto output = result.at(0); // output->printIndexedBuffer("Result is"); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2050,12 +2050,12 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_BP_1) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2071,12 +2071,12 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_BP_2) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps}, {1.f}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2092,12 +2092,12 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_BP_3) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2113,12 +2113,12 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_BP_4) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps}, {1.f}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2136,12 +2136,12 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Sum_BP_04) { sd::ops::reduce_sum_bp op; auto result = op.evaluate({&input, &eps, &axis}, {}, {}, {true}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2161,12 +2161,12 @@ TEST_F(DeclarableOpsTests8, Test_Reduce_Prod_BP_1) { sd::ops::reduce_prod_bp op; auto result = op.evaluate({&input, &eps}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); // z->printIndexedBuffer("Result is "); // z->printShapeInfo(); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2179,14 +2179,14 @@ TEST_F(DeclarableOpsTests8, reduceMean_test1) { sd::ops::reduce_mean op; auto result = op.evaluate({&x}, {}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2199,14 +2199,14 @@ TEST_F(DeclarableOpsTests8, reduceMean_test2) { sd::ops::reduce_mean op; auto result = op.evaluate({&x}, {1.}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2219,14 +2219,14 @@ TEST_F(DeclarableOpsTests8, reduceMean_test3) { sd::ops::reduce_mean op; auto result = op.evaluate({&x}, {}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2239,14 +2239,14 @@ TEST_F(DeclarableOpsTests8, reduceMean_test4) { sd::ops::reduce_mean op; auto result = op.evaluate({&x}, {1.f}, {0,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2259,14 +2259,14 @@ TEST_F(DeclarableOpsTests8, reduceMean_test5) { sd::ops::reduce_mean op; auto result = op.evaluate({&x}, {}, {}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2278,14 +2278,14 @@ TEST_F(DeclarableOpsTests8, reduceMean_test6) { sd::ops::reduce_mean op; auto result = op.evaluate({&x}, {}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2297,14 +2297,14 @@ TEST_F(DeclarableOpsTests8, reduceMean_test7) { sd::ops::reduce_mean op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2317,14 +2317,14 @@ TEST_F(DeclarableOpsTests8, reduceMean_test8) { sd::ops::reduce_mean op; auto result = op.evaluate({&x, &axes}, {}, {}, {true}); - auto output = result->at(0); + auto output = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2340,21 +2340,21 @@ TEST_F(DeclarableOpsTests8, reduceMeanBP_test1) { sd::ops::reduce_mean_bp op; auto result = op.evaluate({&x, &gradO1}, {0}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); // output->printShapeInfo("o"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {1}, {}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } @@ -2371,18 +2371,18 @@ TEST_F(DeclarableOpsTests8, reduceMeanBP_test2) { sd::ops::reduce_mean_bp op; auto result = op.evaluate({&x, &gradO1}, {0}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {1}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2399,18 +2399,18 @@ TEST_F(DeclarableOpsTests8, reduceMeanBP_test02) { sd::ops::reduce_mean_bp op; auto result = op.evaluate({&x, &gradO1, &axis}, {}, {}, {false}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2, &axis}, {}, {}, {true}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2426,18 +2426,18 @@ TEST_F(DeclarableOpsTests8, reduceMeanBP_test3) { sd::ops::reduce_mean_bp op; auto result = op.evaluate({&x, &gradO1}, {0}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {1}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2450,12 +2450,12 @@ TEST_F(DeclarableOpsTests8, reduceStDevBP_test4) { sd::ops::reduce_stdev_bp op; auto result = op.evaluate({&x, &gradO}, {0,1}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } @@ -2471,14 +2471,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test1) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2493,14 +2493,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test2) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2515,14 +2515,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test3) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {1}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2537,14 +2537,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test4) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2559,14 +2559,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test5) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2581,14 +2581,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test6) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2603,14 +2603,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test7) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {1}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2625,14 +2625,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test8) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto *output = results->at(0); + auto *output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2645,14 +2645,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test9) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } /////////////////////////////////////////////////////////////////// @@ -2667,14 +2667,14 @@ TEST_F(DeclarableOpsTests8, softmax_cross_entropy_loss_with_logits_test10) { sd::ops::softmax_cross_entropy_loss_with_logits op; auto results = op.evaluate({&logits, &labels}, {}, {0}); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); - auto output = results->at(0); + auto output = results.at(0); ASSERT_TRUE(expected.isSameShape(output)); ASSERT_TRUE(expected.equalsTo(output)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -2685,12 +2685,12 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test4) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {1.f}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2705,12 +2705,12 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test5) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {15.f}, {0}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2723,12 +2723,12 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test6) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {15.f}, {1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2741,12 +2741,12 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test7) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {15.f}, {0,1}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2759,12 +2759,12 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test8) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {15.}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2775,12 +2775,12 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test9) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {4.}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2791,12 +2791,12 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test10) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {5.}, {}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2810,12 +2810,12 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test11) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {35.}, {0, 2}); - auto output = result->at(0); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } @@ -2826,9 +2826,9 @@ TEST_F(DeclarableOpsTests8, clipbynorm_test_tf_119_1) { sd::ops::clipbynorm op; auto result = op.evaluate({&x}, {0.54}, {}); - ASSERT_EQ(e, *result->at(0)); + ASSERT_EQ(e, *result.at(0)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2842,18 +2842,18 @@ TEST_F(DeclarableOpsTests8, reduceMeanBP_test4) { sd::ops::reduce_mean_bp op; auto result = op.evaluate({&x, &gradO1}, {0}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {1}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } @@ -2868,18 +2868,18 @@ TEST_F(DeclarableOpsTests8, reduceMeanBP_test5) { sd::ops::reduce_mean_bp op; auto result = op.evaluate({&x, &gradO1}, {0}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {1}, {1}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } @@ -2894,18 +2894,18 @@ TEST_F(DeclarableOpsTests8, reduceStDevBP_test5) { sd::ops::reduce_stdev_bp op; auto result = op.evaluate({&x, &gradO1}, {0}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - auto output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO2}, {1}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - output = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2935,12 +2935,12 @@ TEST_F(DeclarableOpsTests8, zeros_as_test2) { sd::ops::zeros_as op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); - auto y = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto y = result.at(0); ASSERT_TRUE(y->isSameShape(exp)); ASSERT_TRUE(y->equalsTo(exp)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2970,12 +2970,12 @@ TEST_F(DeclarableOpsTests8, ones_as_test2) { sd::ops::ones_as op; auto results = op.evaluate({&x}); - ASSERT_EQ(Status::OK(), results->status()); - auto y = results->at(0); + ASSERT_EQ(Status::OK(), results.status()); + auto y = results.at(0); ASSERT_TRUE(y->isSameShape(exp)); ASSERT_TRUE(y->equalsTo(exp)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -2988,12 +2988,13 @@ TEST_F(DeclarableOpsTests8, ones_as_test3) { sd::ops::ones_as op; auto results = op.evaluate({&x}, {}, {}, {}, {sd::DataType::INT32}); - ASSERT_EQ(Status::OK(), results->status()); - auto y = results->at(0); + ASSERT_EQ(Status::OK(), results.status()); + auto y = results.at(0); + ASSERT_TRUE(y->isSameShape(exp)); ASSERT_TRUE(y->equalsTo(exp)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3021,11 +3022,11 @@ TEST_F(DeclarableOpsTests8, NormalizeMoments_SGO_1) { // sd::ops::normalize_moments op; // auto results = op.evaluate({&counts, means, deviance}, {0.0}, {}); - ASSERT_EQ(Status::OK(), results->status()); - ASSERT_EQ(results->size(), 2); + ASSERT_EQ(Status::OK(), results.status()); + ASSERT_EQ(results.size(), 2); - auto outputMeans = results->at(0); - auto outputDeviance = results->at(1); + auto outputMeans = results.at(0); + auto outputDeviance = results.at(1); // outputMeans->printIndexedBuffer("Means"); // outputDeviance->printIndexedBuffer("Variance"); @@ -3041,7 +3042,7 @@ TEST_F(DeclarableOpsTests8, NormalizeMoments_SGO_1) { // ASSERT_TRUE(expMeans.isSameShape(outputDeviance)); // ASSERT_TRUE(expDeviance.equalsTo(outputDeviance)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3055,10 +3056,10 @@ TEST_F(DeclarableOpsTests8, Test_Moments_1) { sd::ops::moments op; auto result = op.evaluate({&x}, {}, {0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto outputMeans = result->at(0); - auto outputVariance = result->at(1); + auto outputMeans = result.at(0); + auto outputVariance = result.at(1); // outputMeans->printIndexedBuffer("Means"); // outputVariance->printIndexedBuffer("Variance"); @@ -3072,7 +3073,7 @@ TEST_F(DeclarableOpsTests8, Test_Moments_1) { ASSERT_TRUE(expVariance.isSameShape(outputVariance)); ASSERT_TRUE(expVariance.equalsTo(outputVariance)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3085,10 +3086,10 @@ TEST_F(DeclarableOpsTests8, Test_Moments_2) { sd::ops::moments op; auto result = op.evaluate({&x}, {1.}, {0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto outputMeans = result->at(0); - auto outputVariance = result->at(1); + auto outputMeans = result.at(0); + auto outputVariance = result.at(1); // outputMeans->printIndexedBuffer("Means"); // outputVariance->printIndexedBuffer("Variance"); @@ -3101,7 +3102,7 @@ TEST_F(DeclarableOpsTests8, Test_Moments_2) { ASSERT_TRUE(expVariance.isSameShape(outputVariance)); ASSERT_TRUE(expVariance.equalsTo(outputVariance)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3114,10 +3115,10 @@ TEST_F(DeclarableOpsTests8, Test_Moments_3) { sd::ops::moments op; auto result = op.evaluate({&x}, {}, {0, 2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto outputMeans = result->at(0); - auto outputVariance = result->at(1); + auto outputMeans = result.at(0); + auto outputVariance = result.at(1); // outputMeans->printIndexedBuffer("Means"); // outputVariance->printIndexedBuffer("Variance"); @@ -3130,7 +3131,7 @@ TEST_F(DeclarableOpsTests8, Test_Moments_3) { ASSERT_TRUE(expVariance.isSameShape(outputVariance)); ASSERT_TRUE(expVariance.equalsTo(outputVariance)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3143,10 +3144,10 @@ TEST_F(DeclarableOpsTests8, Test_Moments_4) { sd::ops::moments op; auto result = op.evaluate({&x}, {1.}, {0, 2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto outputMeans = result->at(0); - auto outputVariance = result->at(1); + auto outputMeans = result.at(0); + auto outputVariance = result.at(1); // outputMeans->printIndexedBuffer("Means"); // outputVariance->printIndexedBuffer("Variance"); @@ -3159,7 +3160,7 @@ TEST_F(DeclarableOpsTests8, Test_Moments_4) { ASSERT_TRUE(expVariance.isSameShape(outputVariance)); ASSERT_TRUE(expVariance.equalsTo(outputVariance)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3172,10 +3173,10 @@ TEST_F(DeclarableOpsTests8, Test_Moments_6) { sd::ops::moments op; auto result = op.evaluate({&x}, {}, {0,1,2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto outputMeans = result->at(0); - auto outputVariance = result->at(1); + auto outputMeans = result.at(0); + auto outputVariance = result.at(1); // outputMeans->printIndexedBuffer("Means"); // outputVariance->printIndexedBuffer("Variance"); @@ -3186,7 +3187,7 @@ TEST_F(DeclarableOpsTests8, Test_Moments_6) { ASSERT_TRUE(expVariance.isSameShape(outputVariance)); ASSERT_TRUE(expVariance.equalsTo(outputVariance)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3201,10 +3202,10 @@ TEST_F(DeclarableOpsTests8, Test_Moments_7) { // x.printIndexedBuffer("Input with shape (2, 3, 4) is"); sd::ops::moments op; auto result = op.evaluate({&x}, {1.}, {0,1,2}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto outputMeans = result->at(0); - auto outputVariance = result->at(1); + auto outputMeans = result.at(0); + auto outputVariance = result.at(1); // outputMeans->printIndexedBuffer("Means"); // outputVariance->printIndexedBuffer("Variance"); @@ -3214,7 +3215,7 @@ TEST_F(DeclarableOpsTests8, Test_Moments_7) { ASSERT_TRUE(expVariance.isSameShape(outputVariance)); ASSERT_TRUE(expVariance.equalsTo(outputVariance)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -3230,15 +3231,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_01) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); //ASSERT_TRUE(exp.isSameShape(out)); //out->printBuffer("LRN out"); //exp.printBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3252,15 +3253,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_02) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); //ASSERT_TRUE(exp.isSameShape(out)); //out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3271,15 +3272,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_03) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {5}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3300,15 +3301,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_1) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3377,15 +3378,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_2) { // sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); // ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3454,15 +3455,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_3) { // sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); // ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3474,15 +3475,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_4) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); // ASSERT_TRUE(exp.isSameShape(out)); // out->printIndexedBuffer("LRN out"); // exp.printIndexedBuffer("LRN exp"); // ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3520,13 +3521,13 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_5) { sd::ops::lrn op; auto results = op.evaluate({&x}, {1.0, 1.0, 0.5}, {2}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); // ASSERT_TRUE(exp.isSameShape(out)); // ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3543,15 +3544,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_BP_01) { /// sd::ops::lrn_bp op; auto results = op.evaluate({&x, &eps}, {1.0, 1.0, 0.5}, {5}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); // ASSERT_TRUE(exp.isSameShape(out)); //out->printBuffer("LRN BP out"); //exp.printBuffer("LRN BP exp"); //ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3574,15 +3575,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_BP_02) { bool gradOK = true; //GradCheck::checkGrad(opFF, opBP, argsHolderFF, argsHolderBP); //auto results = op.execute({&x, &eps}, {1.0, 1.0, 0.5}, {5}, {}, false, sd::DataType::DOUBLE); - //auto out = results->at(0); + //auto out = results.at(0); - //ASSERT_EQ(Status::OK(), results->status()); + //ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradOK); //out->printBuffer("LRN BP out"); //exp.printBuffer("LRN BP exp"); //ASSERT_TRUE(exp.equalsTo(out)); - //delete results; + // } //////////////////////////////////////////////////////////////////////////////// @@ -3599,15 +3600,15 @@ auto exp = NDArrayFactory::create('c', {3,3,5,5}, { /// sd::ops::lrn_bp op; auto results = op.evaluate({&x, &eps}, {1.0, 1.0, 0.5}, {2}, {}, {}, false); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); // ASSERT_TRUE(exp.isSameShape(out)); // out->printBuffer("LRN BP out"); // exp.printBuffer("LRN BP exp"); //ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -3679,15 +3680,15 @@ TYPED_TEST(TypedDeclarableOpsTests8, LrnTest_BP_2) { sd::ops::lrn_bp op; auto results = op.evaluate({&x, &eps}, {1.0, 1.0, 0.5}, {2}, {}, {}, false); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(out)); //out->printBuffer("LRN BP out"); // exp.printIndexedBuffer("LRN exp"); // ASSERT_TRUE(exp.equalsTo(out)); - delete results; + } diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests9.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests9.cpp index 485b07297..a1f9c40a1 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests9.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests9.cpp @@ -52,19 +52,19 @@ TEST_F(DeclarableOpsTests9, reduceStDevBP_test3) { sd::ops::reduce_stdev_bp op; auto result = op.evaluate({&x, &gradO2}, {0,0}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); // output->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,0}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } @@ -81,19 +81,19 @@ TEST_F(DeclarableOpsTests9, reduceStDevBP_test03) { sd::ops::reduce_stdev_bp op; auto result = op.evaluate({&x, &gradO2, &axis}, {}, {}, {false, false}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); // output->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + result = op.evaluate({&x, &gradO1}, {1,0}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } /* @@ -249,13 +249,13 @@ TEST_F(DeclarableOpsTests9, concat_test1) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -273,13 +273,13 @@ TEST_F(DeclarableOpsTests9, concat_test2) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -297,15 +297,15 @@ TEST_F(DeclarableOpsTests9, concat_test3) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); output->printBuffer(); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -319,13 +319,13 @@ TEST_F(DeclarableOpsTests9, concat_test4) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -339,13 +339,13 @@ TEST_F(DeclarableOpsTests9, concat_test5) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -359,13 +359,13 @@ TEST_F(DeclarableOpsTests9, concat_test6) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -379,13 +379,13 @@ TEST_F(DeclarableOpsTests9, concat_test7) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -397,13 +397,13 @@ TEST_F(DeclarableOpsTests9, concat_test8) { sd::ops::concat op; auto result = op.evaluate({&x0}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -415,13 +415,13 @@ TEST_F(DeclarableOpsTests9, concat_test9) { sd::ops::concat op; auto result = op.evaluate({&x0}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -440,13 +440,13 @@ TEST_F(DeclarableOpsTests9, concat_test10) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -465,13 +465,13 @@ TEST_F(DeclarableOpsTests9, concat_test11) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -490,13 +490,13 @@ TEST_F(DeclarableOpsTests9, concat_test12) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -515,14 +515,14 @@ TEST_F(DeclarableOpsTests9, concat_test13) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } TEST_F(DeclarableOpsTests9, concat_test14) { @@ -535,9 +535,9 @@ TEST_F(DeclarableOpsTests9, concat_test14) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1}, {}, {0}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); Nd4jLong numOfTads= ShapeUtils::getNumOfSubArrs(z->getShapeInfo(), {0}); ASSERT_TRUE(2 == numOfTads); @@ -548,7 +548,7 @@ TEST_F(DeclarableOpsTests9, concat_test14) { ASSERT_NEAR((e+1)*1., mean, 1e-5); } - delete result; + } TEST_F(DeclarableOpsTests9, concat_test15) { @@ -558,14 +558,14 @@ TEST_F(DeclarableOpsTests9, concat_test15) { sd::ops::concat op; auto result = op.evaluate({&x, &y}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -577,13 +577,13 @@ TEST_F(DeclarableOpsTests9, concat_test16) { sd::ops::concat op; auto result = op.evaluate({&x, &y}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -597,9 +597,9 @@ TEST_F(DeclarableOpsTests9, concat_test17) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1}, {}, {0}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo(); // z->printIndexedBuffer(); @@ -612,7 +612,7 @@ TEST_F(DeclarableOpsTests9, concat_test17) { ASSERT_NEAR((e+1)*1., mean, 1e-5); } - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -680,9 +680,9 @@ TEST_F(DeclarableOpsTests9, concat_test20) { sd::ops::concat op; auto result = op.evaluate({&x0, &x1, &x2, &x3}, {}, {0}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); Nd4jLong numOfTads= ShapeUtils::getNumOfSubArrs(z->getShapeInfo(), {0}); ASSERT_TRUE(4 == numOfTads); @@ -693,7 +693,7 @@ TEST_F(DeclarableOpsTests9, concat_test20) { ASSERT_NEAR((double) e+1, mean, 1e-5); } - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -769,13 +769,13 @@ TEST_F(DeclarableOpsTests9, concat_test25) { auto result = op.evaluate({&x0, &x1, &axis}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -795,14 +795,12 @@ TEST_F(DeclarableOpsTests9, concat_test26) { auto result = op.evaluate({&x0, &x1, &x2}, {}, {0}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); output->printLinearBuffer(); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - - delete result; } ////////////////////////////////////////////////////////////////////// @@ -816,13 +814,13 @@ TEST_F(DeclarableOpsTests9, tile_bp_test1) { sd::ops::tile_bp op; auto results = op.evaluate({&input, &gradO}, {}, {2, 3}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradIExp.isSameShape(gradI)); ASSERT_TRUE(gradIExp.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -836,12 +834,12 @@ TEST_F(DeclarableOpsTests9, tile_bp_test2) { sd::ops::tile_bp op; auto results = op.evaluate({&input, &gradO}, {}, {1, 3}); - auto gradI = results->at(0); - ASSERT_EQ(Status::OK(), results->status()); + auto gradI = results.at(0); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradIExp.isSameShape(gradI)); ASSERT_TRUE(gradIExp.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -855,13 +853,13 @@ TEST_F(DeclarableOpsTests9, tile_bp_test3) { sd::ops::tile_bp op; auto results = op.evaluate({&input, &gradO}, {}, {1, 1}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradIExp.isSameShape(gradI)); ASSERT_TRUE(gradIExp.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -875,13 +873,13 @@ TEST_F(DeclarableOpsTests9, tile_bp_test4) { sd::ops::tile_bp op; auto results = op.evaluate({&input, &gradO}, {}, {2}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradIExp.isSameShape(gradI)); ASSERT_TRUE(gradIExp.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -895,13 +893,13 @@ TEST_F(DeclarableOpsTests9, tile_bp_test5) { sd::ops::tile_bp op; auto results = op.evaluate({&input, &gradO}, {}, {1}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradIExp.isSameShape(gradI)); ASSERT_TRUE(gradIExp.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -915,13 +913,13 @@ TEST_F(DeclarableOpsTests9, tile_bp_test6) { sd::ops::tile_bp op; auto results = op.evaluate({&input, &gradO}, {}, {1, 3, 2}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradIExp.isSameShape(gradI)); ASSERT_TRUE(gradIExp.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -936,13 +934,13 @@ TEST_F(DeclarableOpsTests9, tile_bp_test7) { sd::ops::tile_bp op; auto results = op.evaluate({&input, &reps, &gradO}, {}, {}); - auto gradI = results->at(0); + auto gradI = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradIExp.isSameShape(gradI)); ASSERT_TRUE(gradIExp.equalsTo(gradI)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -954,13 +952,13 @@ TEST_F(DeclarableOpsTests9, tile_test1) { sd::ops::tile op; auto results = op.evaluate({&input, &reps}, {}, {}); - auto out = results->at(0); + auto out = results.at(0); - ASSERT_EQ(Status::OK(), results->status()); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(expOut.isSameShape(out)); ASSERT_TRUE(expOut.equalsTo(out)); - delete results; + } //////////////////////////////////////////////////////////////////////////////// @@ -973,11 +971,11 @@ TEST_F(DeclarableOpsTests9, TestDropout_BP_1) { auto ress = op.evaluate({&x, &errs, &shape}, {0.2f}, {113}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); - //ress->at(0)->printIndexedBuffer("Result is "); + ASSERT_EQ(ND4J_STATUS_OK, ress.status()); + //ress.at(0)->printIndexedBuffer("Result is "); //x.printIndexedBuffer("Input is"); - ASSERT_FALSE(ress->at(0)->equalsTo(errs)); - delete ress; + ASSERT_FALSE(ress.at(0)->equalsTo(errs)); + } //////////////////////////////////////////////////////////////////////////////// @@ -990,16 +988,16 @@ TEST_F(DeclarableOpsTests9, TestDropout_1) { x.linspace(1); auto ress = op.evaluate({&x}, {0.2f}, {113}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); - NDArray* res = ress->at(0); //->printIndexedBuffer("Result is "); + ASSERT_EQ(ND4J_STATUS_OK, ress.status()); + NDArray* res = ress.at(0); //->printIndexedBuffer("Result is "); //x.printIndexedBuffer("Input is"); //res->printIndexedBuffer("Result for Dropout_1"); auto countZero = res->reduceNumber(reduce::CountZero); ASSERT_NEAR(countZero.e(0), 80, 5); auto ress2 = op.evaluate({&x}, {0.2f}, {113}); - ASSERT_EQ(ND4J_STATUS_OK, ress2->status()); - NDArray* res2 = ress2->at(0); + ASSERT_EQ(ND4J_STATUS_OK, ress2.status()); + NDArray* res2 = ress2.at(0); countZero = res->reduceNumber(reduce::CountZero); ASSERT_NEAR(countZero.e(0), 80, 5); @@ -1008,8 +1006,8 @@ TEST_F(DeclarableOpsTests9, TestDropout_1) { //res->printIndexedBuffer("FF dropout"); //res2->printIndexedBuffer("BP dropout"); - delete ress; - delete ress2; + + } TEST_F(DeclarableOpsTests9, Test_DropoutInverted_01) { @@ -1045,9 +1043,9 @@ TEST_F(DeclarableOpsTests9, Test_DropoutInverted_01) { auto ress = op.evaluate({&x1}, {0.5f}, {119}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); - //ress->at(0)->printIndexedBuffer("01Dropout result is "); - auto count = ress->at(0)->reduceNumber(reduce::CountNonZero); + ASSERT_EQ(ND4J_STATUS_OK, ress.status()); + //ress.at(0)->printIndexedBuffer("01Dropout result is "); + auto count = ress.at(0)->reduceNumber(reduce::CountNonZero); // nd4j_printf("\n01Dropout count %i\n\n", count); sd::ops::dropout_bp op2; @@ -1057,15 +1055,15 @@ TEST_F(DeclarableOpsTests9, Test_DropoutInverted_01) { auto ressX = op2.evaluate({&x1, &x1}, {0.5f}, {119}); // , false, sd::DataType::FLOAT32); // skipped due given by default //x0.printIndexedBuffer("X0"); //x1.printIndexedBuffer("X1"); - ASSERT_EQ(ND4J_STATUS_OK, ressX->status()); + ASSERT_EQ(ND4J_STATUS_OK, ressX.status()); auto ressY = op2.evaluate({&x1, &x0}, {0.5f}, {119}); - ASSERT_EQ(ND4J_STATUS_OK, ressY->status()); + ASSERT_EQ(ND4J_STATUS_OK, ressY.status()); //ressY->at(0)->printIndexedBuffer("BP"); - //ress->at(0)->printIndexedBuffer("FF"); + //ress.at(0)->printIndexedBuffer("FF"); bool ret = true; - for (int e = 0; e < ress->at(0)->lengthOf(); e++) { - if (ress->at(0)->e(e) == 0.f) - if (ressX->at(0)->e(e) != ress->at(0)->e(e)) { + for (int e = 0; e < ress.at(0)->lengthOf(); e++) { + if (ress.at(0)->e(e) == 0.f) + if (ressX.at(0)->e(e) != ress.at(0)->e(e)) { ret = false; break; } @@ -1075,15 +1073,14 @@ TEST_F(DeclarableOpsTests9, Test_DropoutInverted_01) { //ressX->at(0)->printIndexedBuffer("02Dropout result is "); /* float countZero = ressX->at(0)->template reduceNumber>(); ASSERT_NEAR(countZero, 50.f, 5.f); - countZero = ress->at(0)->template reduceNumber>(); + countZero = ress.at(0)->template reduceNumber>(); ASSERT_NEAR(countZero, 50.f, 5.f); countZero = ressY->at(0)->template reduceNumber>(); ASSERT_NEAR(countZero, 50.f, 5.f); */ // ASSERT_TRUE(exp.equalsTo(ressX->at(0))); - delete ressX; - delete ressY; - delete ress; + + } TEST_F(DeclarableOpsTests9, Test_Dropout_BP_2) { @@ -1095,34 +1092,32 @@ TEST_F(DeclarableOpsTests9, Test_Dropout_BP_2) { auto ress = op.evaluate({&x}, {0.5f}, {119}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); -// ress->at(0)->printIndexedBuffer("01Dropout result is "); + ASSERT_EQ(ND4J_STATUS_OK, ress.status()); +// ress.at(0)->printIndexedBuffer("01Dropout result is "); sd::ops::dropout_bp op2; auto ressX = op2.evaluate({&x, &x}, {0.5f}, {119}); - ASSERT_EQ(ND4J_STATUS_OK, ressX->status()); + ASSERT_EQ(ND4J_STATUS_OK, ressX.status()); auto ressY = op2.evaluate({&x, &x}, {0.5f}, {119}); - ASSERT_EQ(ND4J_STATUS_OK, ressY->status()); + ASSERT_EQ(ND4J_STATUS_OK, ressY.status()); - //ress->at(0)->printIndexedBuffer("FF Dropout result is "); + //ress.at(0)->printIndexedBuffer("FF Dropout result is "); //ressY->at(0)->printIndexedBuffer("BP Dropout result is "); - auto countZero = ress->at(0)->reduceNumber(reduce::CountZero); + auto countZero = ress.at(0)->reduceNumber(reduce::CountZero); ASSERT_NEAR(countZero.e(0), 50.f, 10.f); - countZero = ressX->at(0)->reduceNumber(reduce::CountZero); + countZero = ressX.at(0)->reduceNumber(reduce::CountZero); //nd4j_printf("X zero count is %f\n", countZero); ASSERT_NEAR(countZero.e(0), 50.f, 10.f); - countZero = ressY->at(0)->reduceNumber(reduce::CountZero); + countZero = ressY.at(0)->reduceNumber(reduce::CountZero); //nd4j_printf("Y zero count is %f\n", countZero); ASSERT_NEAR(countZero.e(0), 50.f, 10.f); // ASSERT_TRUE(exp.equalsTo(ressX->at(0))); - ASSERT_TRUE(ressX->at(0)->equalsTo(ressY->at(0))); - delete ressX; - delete ressY; - delete ress; + ASSERT_TRUE(ressX.at(0)->equalsTo(ressY.at(0))); + } @@ -1138,20 +1133,17 @@ TEST_F(DeclarableOpsTests9, Test_AlphaDropout_BP_1) { auto ress = op.evaluate({&x, &eps}, {0.5f, 0.5f, 1.5f, 1.6f}, {119}); - ASSERT_EQ(ND4J_STATUS_OK, ress->status()); - NDArray* res = ress->at(0); + ASSERT_EQ(ND4J_STATUS_OK, ress.status()); + NDArray* res = ress.at(0); auto ress2 = op.evaluate({&x, &eps}, {0.5f, 0.5f, 1.5f, 1.6f}, {119}); - ASSERT_EQ(ND4J_STATUS_OK, ress2->status()); - NDArray* res2 = ress2->at(0); + ASSERT_EQ(ND4J_STATUS_OK, ress2.status()); + NDArray* res2 = ress2.at(0); //res->printIndexedBuffer("Result1AlphaBP1"); //res2->printIndexedBuffer("Result1AlphaBP2"); ASSERT_TRUE(res2->equalsTo(res)); - - - delete ress; - delete ress2; + } TEST_F(DeclarableOpsTests9, test_range_int_1) { @@ -1161,11 +1153,10 @@ TEST_F(DeclarableOpsTests9, test_range_int_1) { sd::ops::range op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); - delete result; } TEST_F(DeclarableOpsTests9, test_range_empty_1) { @@ -1175,13 +1166,12 @@ TEST_F(DeclarableOpsTests9, test_range_empty_1) { sd::ops::range op; auto result = op.evaluate({&x0, &x1, &x2}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isEmpty()); - delete result; } @@ -1214,10 +1204,9 @@ TEST_F(DeclarableOpsTests9, test_unstack_1) { sd::ops::unstack op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_EQ(5, result->size()); + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_EQ(5, result.size()); - delete result; } //////////////////////////////////////////////////////////////////////////////// @@ -1232,13 +1221,13 @@ TEST_F(DeclarableOpsTests9, test_unstack_SGO_1) { std::vector z({&z1, &z2, &z3, &z4, &z5}); sd::ops::unstack op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); - ASSERT_EQ(5, result->size()); - for (size_t i = 0; i < result->size(); i++) { - ASSERT_TRUE(result->at(i)->isSameShape(z[i])); - ASSERT_TRUE(result->at(i)->equalsTo(z[i])); + ASSERT_EQ(Status::OK(), result.status()); + ASSERT_EQ(5, result.size()); + for (size_t i = 0; i < result.size(); i++) { + ASSERT_TRUE(result.at(i)->isSameShape(z[i])); + ASSERT_TRUE(result.at(i)->equalsTo(z[i])); } - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1269,12 +1258,12 @@ TEST_F(DeclarableOpsTests9, clipbynorm_test12) { sd::ops::clipbynorm op; auto result = op.evaluate({&y}, {clip}, {axis}); - auto outFF = result->at(0); + auto outFF = result.at(0); ASSERT_TRUE(expect.isSameShape(outFF)); ASSERT_TRUE(expect.equalsTo(outFF)); - delete result; + } @@ -1363,37 +1352,37 @@ TEST_F(DeclarableOpsTests9, cumprod_1) { sd::ops::cumprod op; auto result = op.evaluate({&inputC, &axis}, {}, {exclusive, reverse}); - ASSERT_EQ(Status::OK(), result->status()); - auto z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + auto z = result.at(0); ASSERT_TRUE(expFF.equalsTo(z)); - delete result; + //************************************// exclusive = 1; reverse = 0; result = op.evaluate({&inputC, &axis}, {}, {exclusive, reverse}); - ASSERT_EQ(Status::OK(), result->status()); - z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + z = result.at(0); ASSERT_TRUE(expTF.equalsTo(z)); - delete result; + //************************************// exclusive = 0; reverse = 1; result = op.evaluate({&inputC, &axis}, {}, {exclusive, reverse}); - ASSERT_EQ(Status::OK(), result->status()); - z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + z = result.at(0); ASSERT_TRUE(expFT.equalsTo(z)); - delete result; + //************************************// exclusive = 1; reverse = 1; result = op.evaluate({&inputC, &axis}, {}, {exclusive, reverse}); - ASSERT_EQ(Status::OK(), result->status()); - z = result->at(0); + ASSERT_EQ(Status::OK(), result.status()); + z = result.at(0); ASSERT_TRUE(expTT.equalsTo(z)); - delete result; + } @@ -1421,13 +1410,13 @@ TEST_F(DeclarableOpsTests9, cumprod_2) { sd::ops::cumprod op; auto result = op.evaluate({&x}, {}, {0, 0, 1}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1589,13 +1578,13 @@ TEST_F(DeclarableOpsTests9, prelu_test1) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1607,13 +1596,13 @@ TEST_F(DeclarableOpsTests9, prelu_test2) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1625,13 +1614,13 @@ TEST_F(DeclarableOpsTests9, prelu_test3) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1643,13 +1632,13 @@ TEST_F(DeclarableOpsTests9, prelu_test4) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1661,13 +1650,13 @@ TEST_F(DeclarableOpsTests9, prelu_test5) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1679,13 +1668,13 @@ TEST_F(DeclarableOpsTests9, prelu_test6) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {1,0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } @@ -1698,13 +1687,13 @@ TEST_F(DeclarableOpsTests9, prelu_test7) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {1,0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1716,13 +1705,13 @@ TEST_F(DeclarableOpsTests9, prelu_test8) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {1,0,1,0,1,0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1734,13 +1723,13 @@ TEST_F(DeclarableOpsTests9, prelu_test9) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1752,13 +1741,13 @@ TEST_F(DeclarableOpsTests9, prelu_test10) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1777,13 +1766,13 @@ TEST_F(DeclarableOpsTests9, prelu_test11) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {1,3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1801,13 +1790,13 @@ TEST_F(DeclarableOpsTests9, prelu_test12) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {-1, 2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1825,13 +1814,13 @@ TEST_F(DeclarableOpsTests9, prelu_test13) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {-1, 2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1850,13 +1839,13 @@ TEST_F(DeclarableOpsTests9, prelu_test14) { sd::ops::prelu op; auto result = op.evaluate({&x, &alpha}, {}, {-2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1869,13 +1858,13 @@ TEST_F(DeclarableOpsTests9, thresholdedrelu_test1) { sd::ops::thresholdedrelu op; auto result = op.evaluate({&x}, {theta}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1889,12 +1878,12 @@ TEST_F(DeclarableOpsTests9, compare_and_bitpack_test1) { sd::ops::compare_and_bitpack op; auto result = op.evaluate({&x, &threshold}, {}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); // output->printIndexedBuffer("Packed to uint8"); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -1907,13 +1896,13 @@ TEST_F(DeclarableOpsTests9, thresholdedrelu_test2) { sd::ops::thresholdedrelu op; auto result = op.evaluate({&x}, {theta}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto output = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto output = result.at(0); ASSERT_TRUE(exp.isSameShape(output)); ASSERT_TRUE(exp.equalsTo(output)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2022,13 +2011,13 @@ TEST_F(DeclarableOpsTests9, multiply_test1) { sd::ops::multiply op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2042,13 +2031,13 @@ TEST_F(DeclarableOpsTests9, multiply_test2) { sd::ops::multiply op; auto result = op.evaluate({&y, &x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2062,13 +2051,13 @@ TEST_F(DeclarableOpsTests9, multiply_test3) { sd::ops::multiply op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2081,13 +2070,13 @@ TEST_F(DeclarableOpsTests9, multiply_test4) { sd::ops::multiply op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2099,13 +2088,13 @@ TEST_F(DeclarableOpsTests9, multiply_test5) { sd::ops::multiply op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - auto z = result->at(0); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////////////// @@ -2126,8 +2115,6 @@ TEST_F(DeclarableOpsTests9, multiply_bp_test1) { // resBP->at(0)->printIndexedBuffer("Multiply BP 1x1 x"); // resBP->at(1)->printIndexedBuffer("Multyply BP 1x1 y");*/ const bool isGradCorrect = GradCheck::checkGrad(opFF, opBP, argsHolderFF, argsHolderBP); - delete resFF; - delete resBP; ASSERT_TRUE(isGradCorrect); } @@ -2278,13 +2265,12 @@ TEST_F(DeclarableOpsTests9, Floormod_BP_Test_2) { // delete resFF; sd::ops::floormod_bp opBP; auto resBP = opBP.evaluate({&x, &y, &dLdz}, {}, {}); - ASSERT_TRUE(resBP->status() == ND4J_STATUS_OK); + ASSERT_TRUE(resBP.status() == ND4J_STATUS_OK); // resBP->at(0)->printIndexedBuffer("BP floormod /dx"); // resBP->at(1)->printIndexedBuffer("BP floormod /dy"); - ASSERT_TRUE(dLdz.equalsTo(resBP->at(0))); - ASSERT_TRUE(dLdz.equalsTo(resBP->at(1))); - delete resBP; + ASSERT_TRUE(dLdz.equalsTo(resBP.at(0))); + ASSERT_TRUE(dLdz.equalsTo(resBP.at(1))); // const bool isGradCorrect = GradCheck::checkGrad(opFF, opBP, argsHolderFF, argsHolderBP); @@ -2313,14 +2299,13 @@ TEST_F(DeclarableOpsTests9, Dynamic_Partition_BP_1) { sd::ops::dynamic_partition_bp op2; auto res2 = op2.evaluate({&x, &y, &dLdzX, &dLdzY, &dLdzZ}, {}, {3}); - ASSERT_TRUE(res2->status() == ND4J_STATUS_OK); - ASSERT_TRUE(res2->size() == 2); + ASSERT_TRUE(res2.status() == ND4J_STATUS_OK); + ASSERT_TRUE(res2.size() == 2); // printf("How many: %ul\n", res2->size()); // res2->at(0)->printBuffer("Ouputput0"); // res2->at(1)->printBuffer("Ouputput1"); - ASSERT_TRUE(res2->at(0)->equalsTo(exp)); - delete res1; - delete res2; + ASSERT_TRUE(res2.at(0)->equalsTo(exp)); + } ////////////////////////////////////////////////////////////////////// //TEST_F(DeclarableOpsTests9, Dynamic_Partition_BP_2) { @@ -2358,9 +2343,9 @@ TEST_F(DeclarableOpsTests9, Floormod_BP_Test_4) { auto result = op.evaluate({&x, &y, &eps}, {}, {}); - ASSERT_TRUE(result->size() == 2); - auto gradX = result->at(0); - auto gradY = result->at(1); + ASSERT_TRUE(result.size() == 2); + auto gradX = result.at(0); + auto gradY = result.at(1); // gradX->printIndexedBuffer("gradX"); // gradY->printIndexedBuffer("gradY"); @@ -2368,7 +2353,6 @@ TEST_F(DeclarableOpsTests9, Floormod_BP_Test_4) { ASSERT_TRUE(exp.equalsTo(gradY)); - delete result; } @@ -2403,11 +2387,11 @@ TEST_F(DeclarableOpsTests9, gru_cell_bp_test1) { sd::ops::gruCell op; auto results = op.evaluate(argsHolderFF); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); - auto u = results->at(1); // [bS, nU] - auto c = results->at(2); // [bS, nU] - auto h = results->at(3); // [bS, nU] + auto u = results.at(1); // [bS, nU] + auto c = results.at(2); // [bS, nU] + auto h = results.at(3); // [bS, nU] dLdh = 1.; // SUM loss @@ -2419,7 +2403,7 @@ TEST_F(DeclarableOpsTests9, gru_cell_bp_test1) { dLdu.assign(dLdh * dhdu); dLdr.assign(mmul(dLdc * dcdZc * hi, Wch.transpose())); - delete results; + const OpArgsHolder argsHolderBP({&x, &hi, &W, &Wc, &b, &bc, &dLdr, &dLdu, &dLdc, &dLdh}, {}, {}); @@ -2442,11 +2426,11 @@ TEST_F(DeclarableOpsTests9, Cholesky_Test_1) { sd::ops::cholesky op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - auto res = result->at(0); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + auto res = result.at(0); // res->printIndexedBuffer("Output for Cholesky1"); ASSERT_TRUE(exp.equalsTo(res)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -2458,11 +2442,11 @@ TEST_F(DeclarableOpsTests9, Cholesky_Test_2) { sd::ops::cholesky op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - auto res = result->at(0); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + auto res = result.at(0); // res->printIndexedBuffer("Output for Cholesky 2"); ASSERT_TRUE(exp.equalsTo(res)); - delete result; + } //////////////////////////////////////////////////////////////////// @@ -2474,11 +2458,11 @@ TEST_F(DeclarableOpsTests9, Cholesky_Test_3) { sd::ops::cholesky op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(result->status(), ND4J_STATUS_OK); - auto res = result->at(0); + ASSERT_EQ(result.status(), ND4J_STATUS_OK); + auto res = result.at(0); // res->printIndexedBuffer("Output for Cholesky 3"); ASSERT_TRUE(exp.equalsTo(res, 1e-4)); - delete result; + } //////////////////////////////////////////////////////////////////// diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTestsCuda1.cu b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTestsCuda1.cu index f0230efb4..4f69da61b 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTestsCuda1.cu +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTestsCuda1.cu @@ -51,14 +51,12 @@ TEST_F(DeclarableOpsTestsCuda1, Test_CHOOSE_SCALAR_LARGE) { sd::ops::choose op; //greater than test auto result = op.evaluate({&x}, {0.0},{3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(1); + auto z = result.at(1); ASSERT_EQ(148,z->e(0)); //ASSERT_TRUE(exp.isSameShape(z)); - - delete result; } /* diff --git a/libnd4j/tests_cpu/layers_tests/EmptyTests.cpp b/libnd4j/tests_cpu/layers_tests/EmptyTests.cpp index 1f32b94cc..ab6bad3c4 100644 --- a/libnd4j/tests_cpu/layers_tests/EmptyTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/EmptyTests.cpp @@ -67,9 +67,9 @@ TEST_F(EmptyTests, Test_Concat_1) { sd::ops::concat op; auto result = op.evaluate({empty, vector}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z shape"); // z->printIndexedBuffer("z buffr"); @@ -78,7 +78,6 @@ TEST_F(EmptyTests, Test_Concat_1) { delete empty; delete vector; - delete result; } @@ -92,9 +91,9 @@ TEST_F(EmptyTests, Test_Concat_2) { sd::ops::concat op; auto result = op.evaluate({empty, scalar1, scalar2}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z shape"); // z->printIndexedBuffer("z buffr"); @@ -104,7 +103,6 @@ TEST_F(EmptyTests, Test_Concat_2) { delete empty; delete scalar1; delete scalar2; - delete result; } TEST_F(EmptyTests, Test_Concat_3) { @@ -117,13 +115,12 @@ TEST_F(EmptyTests, Test_Concat_3) { sd::ops::concat op; auto result = op.evaluate({&empty, &scalar1, &scalar2}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(exp, *z); - delete result; } TEST_F(EmptyTests, Test_Concat_4) { @@ -136,13 +133,11 @@ TEST_F(EmptyTests, Test_Concat_4) { sd::ops::concat op; auto result = op.evaluate({&scalar1, &empty, &scalar2}, {}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(exp, *z); - - delete result; } TEST_F(EmptyTests, Test_Reshape_1) { @@ -153,12 +148,11 @@ TEST_F(EmptyTests, Test_Reshape_1) { sd::ops::reshape op; auto result = op.evaluate({&vector, empty}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - ASSERT_EQ(exp, *result->at(0)); + ASSERT_EQ(exp, *result.at(0)); delete empty; - delete result; } TEST_F(EmptyTests, Test_Reshape_3) { @@ -168,14 +162,13 @@ TEST_F(EmptyTests, Test_Reshape_3) { sd::ops::reshape op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(e.isSameShape(z)); ASSERT_EQ(e, *z); - delete result; } TEST_F(EmptyTests, Test_dup_1) { @@ -197,12 +190,11 @@ TEST_F(EmptyTests, test_empty_scatter_1) { sd::ops::scatter_upd op; auto result = op.evaluate({&x, &indices, &updates}, {}, {}, {true}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(x, *z); - delete result; } TEST_F(EmptyTests, test_empty_scatter_2) { @@ -288,17 +280,15 @@ TEST_F(EmptyTests, test_empty_reshape_1) { sd::ops::reshape op; auto result0 = op.evaluate({&x0, &shape0}, {}, {}); - ASSERT_EQ(Status::OK(), result0->status()); - auto z0 = result0->at(0); + ASSERT_EQ(Status::OK(), result0.status()); + auto z0 = result0.at(0); ASSERT_EQ(e0, *z0); auto result1 = op.evaluate({&x1, &shape1}, {}, {}); - ASSERT_EQ(Status::OK(), result1->status()); - auto z1 = result1->at(0); + ASSERT_EQ(Status::OK(), result1.status()); + auto z1 = result1.at(0); ASSERT_EQ(e1, *z1); - delete result0; - delete result1; } @@ -309,12 +299,11 @@ TEST_F(EmptyTests, test_empty_matmul_1) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - delete result; } TEST_F(EmptyTests, test_empty_matmul_2) { @@ -324,10 +313,8 @@ TEST_F(EmptyTests, test_empty_matmul_2) { sd::ops::matmul op; auto result = op.evaluate({&x, &y}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - - delete result; } diff --git a/libnd4j/tests_cpu/layers_tests/HelpersTests1.cpp b/libnd4j/tests_cpu/layers_tests/HelpersTests1.cpp index b06d6b96d..679f0c5eb 100644 --- a/libnd4j/tests_cpu/layers_tests/HelpersTests1.cpp +++ b/libnd4j/tests_cpu/layers_tests/HelpersTests1.cpp @@ -1889,20 +1889,19 @@ TEST_F(HelpersTests1, OpArgsHolder_test3) { OpArgsHolder holderFF({&input}, {}, {2, 3}); sd::ops::tile opFF; // the kind of op doesn't matter, we simply check here whether op.execute() works with OpArgsHolder correctly auto results = opFF.execute(holderFF); - auto tiled = results->at(0); - ASSERT_EQ(Status::OK(), results->status()); + auto tiled = results.at(0); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(exp.isSameShape(tiled)); ASSERT_TRUE(exp.equalsTo(tiled)); - delete results; - + OpArgsHolder holderBP = holderFF.createArgsHolderForBP({&gradO}, true); sd::ops::tile_bp opBP; results = opBP.execute(holderBP); - auto gradI = results->at(0); - ASSERT_EQ(Status::OK(), results->status()); + auto gradI = results.at(0); + ASSERT_EQ(Status::OK(), results.status()); ASSERT_TRUE(gradIExp.isSameShape(gradI)); ASSERT_TRUE(gradIExp.equalsTo(gradI)); - delete results; + } diff --git a/libnd4j/tests_cpu/layers_tests/IndexingTests.cpp b/libnd4j/tests_cpu/layers_tests/IndexingTests.cpp index c43fc6a7b..dbe7ccd0a 100644 --- a/libnd4j/tests_cpu/layers_tests/IndexingTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/IndexingTests.cpp @@ -47,13 +47,13 @@ TEST_F(IndexingTests, StridedSlice_1) { sd::ops::strided_slice op; auto result = op.evaluate({&x, &begin, &end, &strides}, {}, {0,0,0,0,0}); //, 2,2,0, 3,3,3, 1,1,1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -66,14 +66,14 @@ TEST_F(IndexingTests, StridedSlice_2) { sd::ops::strided_slice op; auto result = op.evaluate({&x}, {}, {0,0,0,0,0, 3,2,0, 5,5,3, 1,1,1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -86,14 +86,14 @@ TEST_F(IndexingTests, StridedSlice_3) { sd::ops::strided_slice op; auto result = op.evaluate({&x}, {}, {0,0,0,0,0, 3,2,0, 5,5,3, 1,1,2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -109,15 +109,15 @@ TEST_F(IndexingTests, SimpleSlice_1) { sd::ops::slice op; auto result = op.evaluate({&input}, {}, {1,0,0, 1,1,3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -135,15 +135,15 @@ TEST_F(IndexingTests, SimpleSlice_2) { sd::ops::slice op; auto result = op.evaluate({&input}, {}, {1,0,0, 1,2,3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(IndexingTests, SimpleSlice_3) { @@ -160,15 +160,15 @@ TEST_F(IndexingTests, SimpleSlice_3) { sd::ops::slice op; auto result = op.evaluate({&input}, {}, {1,0,0, 2,1,3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(IndexingTests, SimpleSlice_4) { @@ -180,14 +180,14 @@ TEST_F(IndexingTests, SimpleSlice_4) { sd::ops::slice op; auto result = op.evaluate({&input, &start, &stop}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -204,16 +204,16 @@ TEST_F(IndexingTests, MaskedSlice_0) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix}, {}, {0,0,0,0,0, 1, 2, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -230,14 +230,14 @@ TEST_F(IndexingTests, MaskedSlice_00) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix}, {}, {0,0,0,0,0, 1, 1, 2, 3, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -254,16 +254,16 @@ TEST_F(IndexingTests, MaskedSlice_1) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix}, {}, {0,0,0,0,1, 1, 2, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(IndexingTests, MaskedSlice_2) { @@ -275,14 +275,14 @@ TEST_F(IndexingTests, MaskedSlice_2) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix}, {}, {0,0,0,0,1, 1, 0, 0, 3, 3, 3, 1, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -295,14 +295,14 @@ TEST_F(IndexingTests, MaskedSlice_3) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix}, {}, {0,0,0,0,2, 1, 0, 0, 3, 3, 3, 1, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -315,15 +315,15 @@ TEST_F(IndexingTests, MaskedSlice_4) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix}, {}, {0,0,0,0, 3, 1, 0, 0, 3, 3, 3, 1, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(IndexingTests, Live_Slice_1) { @@ -338,16 +338,16 @@ TEST_F(IndexingTests, Live_Slice_1) { sd::ops::strided_slice op; auto result = op.evaluate({&matrix, &begin, &end, &stride}, {}, {0,0,0,0,3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -361,14 +361,14 @@ TEST_F(IndexingTests, Test_StridedSlice_1) { sd::ops::strided_slice op; auto result = op.evaluate({&x, &a, &b, &c}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(IndexingTests, Test_StridedSlice_2) { @@ -381,16 +381,16 @@ TEST_F(IndexingTests, Test_StridedSlice_2) { sd::ops::strided_slice op; auto result = op.evaluate({&x, &a, &b, &c}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -404,14 +404,14 @@ TEST_F(IndexingTests, Test_StridedSlice_3) { sd::ops::strided_slice op; auto result = op.evaluate({&x, &a, &b, &c}, {}, {0, 0, 0, 0, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -426,16 +426,16 @@ TEST_F(IndexingTests, Test_StridedSlice_4) { auto result = op.evaluate({&x, &a, &b, &c}, {}, {0, 0, 0, 0, 1}); // auto result = op.execute({&x, &a, &b, &c}, {}, {0, 0, 0, 0, 1, 0, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printIndexedBuffer("Z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(IndexingTests, Test_Subarray_Strided_1) { @@ -458,13 +458,13 @@ TEST_F(IndexingTests, MaskedSlice_5) { sd::ops::strided_slice op; auto result = op.execute({&matrix}, {}, {0,0,0,0,2, 1, 0, 0, 3, 3, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } */ \ No newline at end of file diff --git a/libnd4j/tests_cpu/layers_tests/LegacyOpsTests.cpp b/libnd4j/tests_cpu/layers_tests/LegacyOpsTests.cpp index bdb30aeba..dae5ba5b9 100644 --- a/libnd4j/tests_cpu/layers_tests/LegacyOpsTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/LegacyOpsTests.cpp @@ -64,13 +64,13 @@ TEST_F(LegacyOpsTests, TransformTests_2) { sd::ops::LegacyTransformSameOp op(transform::Neg); // Neg auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(LegacyOpsTests, Reciprocal_1) { @@ -121,12 +121,12 @@ TEST_F(LegacyOpsTests, PWT_Tests_2) { sd::ops::LegacyPairwiseTransformOp op(pairwise::Multiply); // Multiply auto result = op.evaluate({&x, &y}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); //z->printBuffer("Z"); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(LegacyOpsTests, Scalar_Test_1) { @@ -154,10 +154,10 @@ TEST_F(LegacyOpsTests, Scalar_Test_2) { sd::ops::LegacyScalarOp op(scalar::Add, y); auto result = op.evaluate({&x}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -169,14 +169,14 @@ TEST_F(LegacyOpsTests, ReduceTests_1) { auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer("ReduceTest1"); ASSERT_TRUE(z->isScalar()); ASSERT_NEAR(x.sumNumber().e(0), z->e(0), 1e-5f); - delete result; + } @@ -188,16 +188,16 @@ TEST_F(LegacyOpsTests, ReduceTests_2) { auto axis = NDArrayFactory::create('c', {1}, {1}); auto result = op.evaluate({&x, &axis}, {}, {}); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); auto exp = x.reduceAlongDimension(reduce::Sum, {1}); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -209,15 +209,15 @@ TEST_F(LegacyOpsTests, ReduceTests_3) { sd::ops::LegacyReduceSameOp op(reduce::Sum); auto result = op.evaluate({&x, &indices}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); auto exp = x.reduceAlongDimension(reduce::Sum,{1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -229,16 +229,16 @@ TEST_F(LegacyOpsTests, ReduceTests_4) { sd::ops::LegacyReduceSameOp op(reduce::Sum); auto result = op.evaluate({&x, &indices}, {}, {}, {true}); - auto z = result->at(0); + auto z = result.at(0); auto exp = x.reduceAlongDimension(reduce::Sum, {1}, true); // indices.printShapeInfo("Indices shape"); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); // z->printIndexedBuffer("Output reduce 4"); // exp.printIndexedBuffer("Expected reduce 4"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(LegacyOpsTests, ReduceTests_5) { @@ -249,14 +249,14 @@ TEST_F(LegacyOpsTests, ReduceTests_5) { auto result = op.evaluate({&x}); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer("ReduceTest1"); ASSERT_TRUE(z->isScalar()); ASSERT_NEAR(x.meanNumber().e(0), z->e(0), 1e-5f); - delete result; + } @@ -268,16 +268,16 @@ TEST_F(LegacyOpsTests, ReduceTests_6) { auto result = op.evaluate({&x, &axis}, {}, {}); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); auto exp = x.reduceAlongDimension(reduce::Mean, {1}); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -289,15 +289,15 @@ TEST_F(LegacyOpsTests, ReduceTests_7) { sd::ops::LegacyReduceFloatOp op(reduce::Mean); auto result = op.evaluate({&x, &indices}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); auto exp = x.reduceAlongDimension(reduce::Mean,{1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -309,17 +309,17 @@ TEST_F(LegacyOpsTests, ReduceTests_8) { sd::ops::LegacyReduceFloatOp op(reduce::Mean); auto result = op.evaluate({&x, &indices}, {}, {}, {true}); - auto z = result->at(0); + auto z = result.at(0); auto exp = x.reduceAlongDimension(reduce::Mean, {1}, true); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); // z->printIndexedBuffer("Reduce8 output"); // z->printShapeInfo("Reduce8 shape"); // exp.printShapeInfo("Reduce8 expected shape"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -331,14 +331,14 @@ TEST_F(LegacyOpsTests, IndexReduceTests_1) { auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isScalar()); ASSERT_EQ(24, z->e(0)); - delete result; + } @@ -351,9 +351,9 @@ TEST_F(LegacyOpsTests, IndexReduceTests_2) { auto result = op.evaluate({&x, &indices}, {}, {}); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Hello indexreduce2"); ASSERT_TRUE(exp.equalsTo(z)); //ASSERT_EQ(4, z->e(0)); @@ -362,7 +362,7 @@ TEST_F(LegacyOpsTests, IndexReduceTests_2) { //ASSERT_EQ(4, z->e(3)); //ASSERT_EQ(4, z->e(4)); - delete result; + } TEST_F(LegacyOpsTests, BroadcastingTests_1) { diff --git a/libnd4j/tests_cpu/layers_tests/ListOperationsTests.cpp b/libnd4j/tests_cpu/layers_tests/ListOperationsTests.cpp index ba019d9b0..04e4a70e8 100644 --- a/libnd4j/tests_cpu/layers_tests/ListOperationsTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/ListOperationsTests.cpp @@ -39,7 +39,7 @@ TEST_F(ListOperationsTests, BasicTest_Write_1) { auto result = op.execute(&list, {&x}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_EQ(1, list.elements()); @@ -47,8 +47,8 @@ TEST_F(ListOperationsTests, BasicTest_Write_1) { ASSERT_EQ(2, list.elements()); - delete result; - delete result2; + + } TEST_F(ListOperationsTests, BasicTest_Stack_1) { @@ -66,15 +66,15 @@ TEST_F(ListOperationsTests, BasicTest_Stack_1) { auto result = op.execute(&list, {}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ListOperationsTests, BasicTest_UnStackList_1) { @@ -93,10 +93,10 @@ TEST_F(ListOperationsTests, BasicTest_UnStackList_1) { auto result = op.execute(&list, {&x}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); ASSERT_EQ(list.elements(), 10); -// auto z = result->at(0); +// auto z = result.at(0); // z->printShapeInfo("The first of"); // ASSERT_TRUE(exp.isSameShape(z)); // ASSERT_TRUE(exp.equalsTo(z)); @@ -107,7 +107,7 @@ TEST_F(ListOperationsTests, BasicTest_UnStackList_1) { delete row; } - delete result; + } //TEST_F(ListOperationsTests, BasicTest_UnStackList_2) { @@ -126,20 +126,20 @@ TEST_F(ListOperationsTests, BasicTest_UnStackList_1) { // // auto result = op.execute(nullptr, {&x}, {}, {0}); // -// ASSERT_EQ(ND4J_STATUS_OK, result->status()); +// ASSERT_EQ(ND4J_STATUS_OK, result.status()); // ASSERT_EQ(result->size(), 10); // -// // auto z = result->at(0); +// // auto z = result.at(0); //// z->printShapeInfo("The first of"); //// ASSERT_TRUE(exp.isSameShape(z)); //// ASSERT_TRUE(exp.equalsTo(z)); // for (int e = 0; e < 10; e++) { -// auto row = result->at(e); +// auto row = result.at(e); // ASSERT_TRUE(row->equalsTo(tads->at(e))); // //list.write(e, row); // } // -// delete result; +// // delete tads; //} @@ -160,14 +160,14 @@ TEST_F(ListOperationsTests, BasicTest_Read_1) { auto result = op.execute(&list, {}, {}, {4}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ListOperationsTests, BasicTest_Pick_1) { @@ -192,14 +192,14 @@ TEST_F(ListOperationsTests, BasicTest_Pick_1) { sd::ops::pick_list op; auto result = op.execute(&list, {}, {}, {1, 1, 3, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ListOperationsTests, BasicTest_Size_1) { @@ -217,14 +217,14 @@ TEST_F(ListOperationsTests, BasicTest_Size_1) { auto result = op.execute(&list, {}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ListOperationsTests, BasicTest_Create_1) { @@ -235,12 +235,12 @@ TEST_F(ListOperationsTests, BasicTest_Create_1) { auto result = op.execute(nullptr, {&matrix}, {}, {1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); // we return flow as well - ASSERT_EQ(1, result->size()); + ASSERT_EQ(1, result.size()); - delete result; + } TEST_F(ListOperationsTests, BasicTest_Split_1) { @@ -283,7 +283,7 @@ TEST_F(ListOperationsTests, BasicTest_Split_1) { sd::ops::split_list op; auto result = op.execute(&list, {&matrix, &lengths}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_EQ(3, list.height()); @@ -296,7 +296,7 @@ TEST_F(ListOperationsTests, BasicTest_Split_1) { ASSERT_TRUE(exp2.isSameShape(list.readRaw(2))); ASSERT_TRUE(exp2.equalsTo(list.readRaw(2))); - delete result; + } TEST_F(ListOperationsTests, BasicTest_Scatter_1) { @@ -319,7 +319,7 @@ TEST_F(ListOperationsTests, BasicTest_Scatter_1) { sd::ops::scatter_list op; auto result = op.execute(&list, {&indices, &matrix, &s}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); for (int e = 0; e < 10; e++) { auto row = tads.at(9 - e); @@ -329,7 +329,7 @@ TEST_F(ListOperationsTests, BasicTest_Scatter_1) { ASSERT_TRUE(chunk->equalsTo(row)); } - delete result; + } TEST_F(ListOperationsTests, BasicTest_Clone_1) { @@ -385,10 +385,10 @@ TEST_F(ListOperationsTests, BasicTest_Gather_1) { sd::ops::gather_list op; auto result = op.execute(&list, {&indices}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); - ASSERT_EQ(1, result->size()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); + ASSERT_EQ(1, result.size()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); @@ -397,7 +397,7 @@ TEST_F(ListOperationsTests, BasicTest_Gather_1) { ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ListOperationsTests, GraphTests_Sequential_1) { diff --git a/libnd4j/tests_cpu/layers_tests/MultiDataTypeTests.cpp b/libnd4j/tests_cpu/layers_tests/MultiDataTypeTests.cpp index 0f5b5ed62..db342771e 100644 --- a/libnd4j/tests_cpu/layers_tests/MultiDataTypeTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/MultiDataTypeTests.cpp @@ -134,13 +134,11 @@ TEST_F(MultiDataTypeTests, Basic_Test_7) { sd::ops::add op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(e, *z); - - delete result; } //////////////////////////////////////////////////////////////////////////////// diff --git a/libnd4j/tests_cpu/layers_tests/NlpTests.cpp b/libnd4j/tests_cpu/layers_tests/NlpTests.cpp index daf43f1a7..2325e2445 100644 --- a/libnd4j/tests_cpu/layers_tests/NlpTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/NlpTests.cpp @@ -66,7 +66,7 @@ TEST_F(NlpTests, basic_sg_hs_test_1) { sd::ops::skipgram op; auto result = op.evaluate({&target, &ngStarter, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &inferenceVector, &neu1e}, {}, {}, {false}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); auto row0 = syn0({0,1, 0,0}, true); auto row1 = syn1({1,2, 0,0}, true); @@ -74,7 +74,7 @@ TEST_F(NlpTests, basic_sg_hs_test_1) { ASSERT_EQ(exp0, row0); ASSERT_EQ(exp1, row1); - delete result; + } TEST_F(NlpTests, basic_sg_hs_test_2) { @@ -107,7 +107,7 @@ TEST_F(NlpTests, basic_sg_hs_test_2) { sd::ops::skipgram op; auto result = op.evaluate({&target, &ngStarter, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &inferenceVector, &neu1e}, {}, {}, {false}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); auto row0 = syn0({0,1, 0,0}, true); auto row1 = syn1({1,2, 0,0}, true); @@ -117,7 +117,7 @@ TEST_F(NlpTests, basic_sg_hs_test_2) { ASSERT_EQ(exp1, row1); ASSERT_EQ(exp2, row2); - delete result; + } TEST_F(NlpTests, basic_sg_hs_test_3) { @@ -159,7 +159,7 @@ TEST_F(NlpTests, basic_sg_hs_test_3) { sd::ops::skipgram op; auto result0 = op.evaluate({&target, &ngStarter, &indices0, &codes00, &syn00, &syn10, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &inferenceVector, &neu1e}, {}, {}, {false}, {}, true); auto result1 = op.evaluate({&target, &ngStarter, &indices1, &codes01, &syn01, &syn11, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &inferenceVector, &neu1e}, {}, {}, {false}, {}, true); - ASSERT_EQ(Status::OK(), result0->status()); + ASSERT_EQ(Status::OK(), result0.status()); auto row00 = syn00({0,1, 0,0}, true); auto row01 = syn01({0,1, 0,0}, true); @@ -168,9 +168,6 @@ TEST_F(NlpTests, basic_sg_hs_test_3) { ASSERT_EQ(row2, row1); ASSERT_EQ(row00, row01); - - delete result0; - delete result1; } TEST_F(NlpTests, basic_sg_hs_ns_test_1) { @@ -192,9 +189,9 @@ TEST_F(NlpTests, basic_sg_hs_ns_test_1) { sd::ops::skipgram op; auto result = op.evaluate({&target, &ngStarter, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &inferenceVector, &neu1e}, {}, {3}, {false}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; + } TEST_F(NlpTests, basic_sg_ns_test_1) { @@ -227,14 +224,14 @@ TEST_F(NlpTests, basic_sg_ns_test_1) { sd::ops::skipgram op; auto result = op.evaluate({&target, &ngStarter, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &inferenceVector, &neu1e}, {}, {1, 1}, {false}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); auto row0 = syn0({1,2, 0,0}, true); ASSERT_EQ(exp0, row0); ASSERT_FALSE(syn1Neg2.equalsTo(syn1Neg, 1e-6)); - delete result; + } TEST_F(NlpTests, basic_cb_hs_test_1) { @@ -269,7 +266,7 @@ TEST_F(NlpTests, basic_cb_hs_test_1) { sd::ops::cbow op; auto result = op.evaluate({&target, &ngStarter, &context, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &numWords, &locked, &inferenceVector}, {}, {}, {true}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); auto row_s0_0 = syn0({0,1, 0,0}, true); auto row_s0_1 = syn0({1,2, 0,0}, true); @@ -287,7 +284,7 @@ TEST_F(NlpTests, basic_cb_hs_test_1) { ASSERT_EQ(exp1, row_s1_5); ASSERT_EQ(exp2, row_s1_6); - delete result; + } TEST_F(NlpTests, basic_cb_ns_test_1) { @@ -323,7 +320,7 @@ TEST_F(NlpTests, basic_cb_ns_test_1) { sd::ops::cbow op; auto result = op.evaluate({&target, &ngStarter, &context, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &numWords, &locked, &inferenceVector}, {}, {1, 2, 0}, {true}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); auto row_s0_0 = syn0({0,1, 0,0}, true); auto row_s0_1 = syn0({1,2, 0,0}, true); @@ -339,7 +336,7 @@ TEST_F(NlpTests, basic_cb_ns_test_1) { ASSERT_EQ(exp0, row_s0_2); ASSERT_EQ(exp2, row_s1_6); - delete result; + } TEST_F(NlpTests, test_sg_hs_batch_1) { @@ -372,7 +369,7 @@ TEST_F(NlpTests, test_sg_hs_batch_1) { sd::ops::skipgram op; auto result = op.evaluate({&target, &ngStarter, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &inferenceVector, &neu1e}, {}, {}, {false, true}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); auto row0 = syn0({0,1, 0,0}, true); auto row1 = syn1({1,2, 0,0}, true); @@ -382,7 +379,7 @@ TEST_F(NlpTests, test_sg_hs_batch_1) { ASSERT_TRUE(exp1.equalsTo(row1, 1e-6)); ASSERT_TRUE(exp2.equalsTo(row2, 1e-6)); - delete result; + } TEST_F(NlpTests, test_sg_ns_batch_1) { @@ -416,9 +413,9 @@ TEST_F(NlpTests, test_sg_ns_batch_1) { sd::ops::skipgram op; auto result = op.evaluate({&target, &ngStarter, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &inferenceVector, &neu1e}, {}, {4, 5}, {false, true}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - delete result; + } TEST_F(NlpTests, test_cbow_hs_batch_1) { @@ -449,7 +446,7 @@ TEST_F(NlpTests, test_cbow_hs_batch_1) { sd::ops::cbow op; auto result = op.evaluate({&target, &ngStarter, &context, &indices, &codes, &syn0, &syn1, &syn1Neg, &expTable, &negTable, &alpha, &randomValue, &numWords, &locked, &inferenceVector}, {}, {}, {true}, {}, true); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); auto exp0 = NDArrayFactory::create('c', {1, 10}); auto exp1 = NDArrayFactory::create('c', {1, 10}); @@ -473,6 +470,5 @@ TEST_F(NlpTests, test_cbow_hs_batch_1) { ASSERT_EQ(exp1, row_s1_4); ASSERT_EQ(exp1, row_s1_5); ASSERT_EQ(exp2, row_s1_6); - - delete result; -} \ No newline at end of file + +} diff --git a/libnd4j/tests_cpu/layers_tests/ParityOpsTests.cpp b/libnd4j/tests_cpu/layers_tests/ParityOpsTests.cpp index b95853fee..ce24c8a9b 100644 --- a/libnd4j/tests_cpu/layers_tests/ParityOpsTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/ParityOpsTests.cpp @@ -43,12 +43,12 @@ TEST_F(ParityOpsTests, TestZeroAs1) { auto result = op.evaluate({&x}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(z->isSameShape(&x)); ASSERT_TRUE(z->equalsTo(&exp)); - delete result; + } TEST_F(ParityOpsTests, TestMaximum1) { @@ -62,11 +62,11 @@ TEST_F(ParityOpsTests, TestMaximum1) { auto result = op.evaluate({&x, &y}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(y.equalsTo(z)); - delete result; + } @@ -82,11 +82,11 @@ TEST_F(ParityOpsTests, TestMinimum1) { auto result = op.evaluate({&x, &y}, {}, {}); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(y.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, TestTear1) { @@ -101,12 +101,12 @@ TEST_F(ParityOpsTests, TestTear1) { auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(10, result->size()); + ASSERT_EQ(10, result.size()); - for (int e = 0; e < result->size(); e++) - ASSERT_TRUE(tads.at(e)->equalsTo(result->at(e))); + for (int e = 0; e < result.size(); e++) + ASSERT_TRUE(tads.at(e)->equalsTo(result.at(e))); - delete result; + } TEST_F(ParityOpsTests, TestUnstack1) { @@ -121,12 +121,12 @@ TEST_F(ParityOpsTests, TestUnstack1) { auto result = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(10, result->size()); + ASSERT_EQ(10, result.size()); - for (int e = 0; e < result->size(); e++) - ASSERT_TRUE(tads.at(e)->equalsTo(result->at(e))); + for (int e = 0; e < result.size(); e++) + ASSERT_TRUE(tads.at(e)->equalsTo(result.at(e))); - delete result; + } @@ -143,12 +143,12 @@ TEST_F(ParityOpsTests, TestUnstack2) { auto result = op.evaluate({&input}, {}, {2}); - ASSERT_EQ(6, result->size()); + ASSERT_EQ(6, result.size()); - for (int e = 0; e < result->size(); e++) - ASSERT_TRUE(tads.at(e)->equalsTo(result->at(e))); + for (int e = 0; e < result.size(); e++) + ASSERT_TRUE(tads.at(e)->equalsTo(result.at(e))); - delete result; + } TEST_F(ParityOpsTests, TestUnstack3) { @@ -159,14 +159,14 @@ TEST_F(ParityOpsTests, TestUnstack3) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -178,14 +178,14 @@ TEST_F(ParityOpsTests, TestUnstack4) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, TestUnstack5) { @@ -196,14 +196,14 @@ TEST_F(ParityOpsTests, TestUnstack5) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, TestUnstack6) { @@ -214,14 +214,14 @@ TEST_F(ParityOpsTests, TestUnstack6) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, TestUnstack7) { @@ -232,14 +232,14 @@ TEST_F(ParityOpsTests, TestUnstack7) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, TestUnstack8) { @@ -250,14 +250,14 @@ TEST_F(ParityOpsTests, TestUnstack8) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, TestUnstack9) { @@ -268,14 +268,14 @@ TEST_F(ParityOpsTests, TestUnstack9) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -287,13 +287,13 @@ TEST_F(ParityOpsTests, TestUnstack10) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.isSameShape(result->at(1))); - ASSERT_TRUE(exp.isSameShape(result->at(2))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(1))); + ASSERT_TRUE(exp.isSameShape(result.at(2))); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -305,12 +305,12 @@ TEST_F(ParityOpsTests, TestUnstack11) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_TRUE(exp.isSameShape(result->at(0))); - ASSERT_TRUE(exp.isSameShape(result->at(1))); + ASSERT_TRUE(exp.isSameShape(result.at(0))); + ASSERT_TRUE(exp.isSameShape(result.at(1))); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -321,11 +321,11 @@ TEST_F(ParityOpsTests, TestUnstack12) { sd::ops::unstack op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_TRUE(result->size() == 0); + ASSERT_TRUE(result.size() == 0); - delete result; + } TEST_F(ParityOpsTests, TestUnstack13) { @@ -335,14 +335,13 @@ TEST_F(ParityOpsTests, TestUnstack13) { sd::ops::unstack op; auto result = op.evaluate({&x}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - ASSERT_EQ(3, result->size()); + ASSERT_EQ(3, result.size()); for (int e = 0; e < 3; e++) - ASSERT_EQ(1, result->at(e)->rankOf()); + ASSERT_EQ(1, result.at(e)->rankOf()); - delete result; } @@ -355,14 +354,14 @@ TEST_F(ParityOpsTests, ExpandDimsTest1) { sd::ops::expand_dims op; auto result = op.evaluate({&input}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(reshaped.isSameShape(z)); ASSERT_TRUE(reshaped.equalsTo(z)); - delete result; + } @@ -374,14 +373,14 @@ TEST_F(ParityOpsTests, ExpandDimsTest2) { sd::ops::expand_dims op; auto result = op.evaluate({&input}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(reshaped.isSameShape(z)); ASSERT_TRUE(reshaped.equalsTo(z)); - delete result; + } @@ -393,14 +392,14 @@ TEST_F(ParityOpsTests, ExpandDimsTest3) { sd::ops::expand_dims op; auto result = op.evaluate({&input}, {}, {-2}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(reshaped.isSameShape(z)); ASSERT_TRUE(reshaped.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, ExpandDimsTest4) { @@ -411,14 +410,14 @@ TEST_F(ParityOpsTests, ExpandDimsTest4) { sd::ops::expand_dims op; auto result = op.evaluate({&input}, {}, {-3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(reshaped.isSameShape(z)); ASSERT_TRUE(reshaped.equalsTo(z)); - delete result; + } @@ -428,14 +427,14 @@ TEST_F(ParityOpsTests, Test_Shape_1) { sd::ops::shape_of op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -446,14 +445,14 @@ TEST_F(ParityOpsTests, Test_Equals_1) { sd::ops::equals op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -464,14 +463,14 @@ TEST_F(ParityOpsTests, Test_NotEquals_1) { sd::ops::not_equals op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_Less_1) { @@ -481,14 +480,14 @@ TEST_F(ParityOpsTests, Test_Less_1) { sd::ops::less op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_LessEquals_1) { @@ -498,14 +497,14 @@ TEST_F(ParityOpsTests, Test_LessEquals_1) { sd::ops::less_equal op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_GreaterEquals_1) { @@ -515,14 +514,14 @@ TEST_F(ParityOpsTests, Test_GreaterEquals_1) { sd::ops::greater_equal op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_GreaterEquals_2) { @@ -532,14 +531,14 @@ TEST_F(ParityOpsTests, Test_GreaterEquals_2) { sd::ops::greater_equal op; auto result = op.evaluate({&x, &y}, {}, {}, {}, {}, false); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_Greater_1) { @@ -549,14 +548,14 @@ TEST_F(ParityOpsTests, Test_Greater_1) { sd::ops::greater op; auto result = op.evaluate({&x, &y}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_Where_1) { @@ -567,16 +566,16 @@ TEST_F(ParityOpsTests, Test_Where_1) { sd::ops::Where op; auto result = op.evaluate({&mask, &x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("result"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_Where_2) { @@ -587,14 +586,14 @@ TEST_F(ParityOpsTests, Test_Where_2) { sd::ops::Where op; auto result = op.evaluate({&mask, &x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -604,16 +603,16 @@ TEST_F(ParityOpsTests, Test_Where_3) { sd::ops::Where op; auto result = op.evaluate({&mask}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printShapeInfo("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_Select_1) { @@ -624,14 +623,14 @@ TEST_F(ParityOpsTests, Test_Select_1) { sd::ops::select op; auto result = op.evaluate({&mask, &x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_Select_2) { @@ -642,14 +641,14 @@ TEST_F(ParityOpsTests, Test_Select_2) { sd::ops::select op; auto result = op.evaluate({&mask, &x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, Test_Select_3) { @@ -661,14 +660,13 @@ TEST_F(ParityOpsTests, Test_Select_3) { sd::ops::select op; auto result = op.evaluate({&mask, &x, &y}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, Test_Reshape_TF_1) { @@ -680,14 +678,13 @@ TEST_F(ParityOpsTests, Test_Reshape_TF_1) { sd::ops::reshape op; auto result = op.evaluate({&x, &shape}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, Test_Bias_Add_1) { @@ -697,16 +694,15 @@ TEST_F(ParityOpsTests, Test_Bias_Add_1) { sd::ops::biasadd op; auto result = op.evaluate({&x, &bias}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); auto tads = z->allTensorsAlongDimension({1}); for (int e = 0; e < tads.size(); e++) { ASSERT_TRUE(bias.equalsTo(tads.at(e))); } - - delete result; + } TEST_F(ParityOpsTests, Test_Scatter_Add_1) { @@ -717,13 +713,12 @@ TEST_F(ParityOpsTests, Test_Scatter_Add_1) { sd::ops::scatter_add op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, Test_Scatter_Add_2) { @@ -735,13 +730,12 @@ TEST_F(ParityOpsTests, Test_Scatter_Add_2) { sd::ops::scatter_add op; auto result = op.evaluate({&vec, &idc, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, Test_Scatter_Add_3) { @@ -752,13 +746,12 @@ TEST_F(ParityOpsTests, Test_Scatter_Add_3) { sd::ops::scatter_add op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, Test_Scatter_Add_4) { @@ -769,13 +762,12 @@ TEST_F(ParityOpsTests, Test_Scatter_Add_4) { sd::ops::scatter_add op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true, true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, Test_Scatter_Add_5) { @@ -786,14 +778,13 @@ TEST_F(ParityOpsTests, Test_Scatter_Add_5) { sd::ops::scatter_add op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, Test_Scatter_Add_6) { @@ -804,13 +795,12 @@ TEST_F(ParityOpsTests, Test_Scatter_Add_6) { sd::ops::scatter_add op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true, true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, Test_Scatter_Add_7) { @@ -821,13 +811,12 @@ TEST_F(ParityOpsTests, Test_Scatter_Add_7) { sd::ops::scatter_add op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////// @@ -870,13 +859,12 @@ TEST_F(ParityOpsTests, scatterMax_test1) { sd::ops::scatter_max op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, scatterMax_test2) { @@ -887,13 +875,12 @@ TEST_F(ParityOpsTests, scatterMax_test2) { sd::ops::scatter_max op; auto result = op.evaluate({&vec, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, scatterMax_test3) { @@ -904,13 +891,13 @@ TEST_F(ParityOpsTests, scatterMax_test3) { sd::ops::scatter_max op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, scatterMax_test4) { @@ -921,13 +908,12 @@ TEST_F(ParityOpsTests, scatterMax_test4) { sd::ops::scatter_max op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {true}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, scatterMax_test5) { @@ -938,13 +924,12 @@ TEST_F(ParityOpsTests, scatterMax_test5) { sd::ops::scatter_max op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, scatterMax_test6) { @@ -955,13 +940,12 @@ TEST_F(ParityOpsTests, scatterMax_test6) { sd::ops::scatter_max op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } @@ -973,13 +957,13 @@ TEST_F(ParityOpsTests, scatterMin_test1) { sd::ops::scatter_min op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ParityOpsTests, scatterMin_test2) { @@ -990,13 +974,12 @@ TEST_F(ParityOpsTests, scatterMin_test2) { sd::ops::scatter_min op; auto result = op.evaluate({&vec, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, scatterMin_test3) { @@ -1007,13 +990,12 @@ TEST_F(ParityOpsTests, scatterMin_test3) { sd::ops::scatter_min op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } TEST_F(ParityOpsTests, scatterMin_test4) { @@ -1024,14 +1006,13 @@ TEST_F(ParityOpsTests, scatterMin_test4) { sd::ops::scatter_min op; auto result = op.evaluate({&matrix, &idc, &updates}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1056,15 +1037,14 @@ TEST_F(ParityOpsTests, scatterND_test1) { sd::ops::scatter_nd op; auto result = op.evaluate({&indices, &updates, &shape}, {}, {false, true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1078,14 +1058,13 @@ TEST_F(ParityOpsTests, scatterND_test2) { sd::ops::scatter_nd op; auto result = op.evaluate({&indices, &updates, &shape}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1103,14 +1082,13 @@ TEST_F(ParityOpsTests, scatterND_test3) { sd::ops::scatter_nd op; auto result = op.evaluate({&indices, &updates, &shape}, {}, {false, true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1123,14 +1101,13 @@ TEST_F(ParityOpsTests, scatterND_test4) { sd::ops::scatter_nd op; auto result = op.evaluate({&indices, &updates, &shape}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1143,15 +1120,14 @@ TEST_F(ParityOpsTests, scatterND_test5) { sd::ops::scatter_nd op; auto result = op.evaluate({&indices, &updates, &shape}, {}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1170,15 +1146,15 @@ TEST_F(ParityOpsTests, scatterND_test6) { sd::ops::scatter_nd op; auto result = op.evaluate({&indices, &updates, &shape}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1197,15 +1173,15 @@ TEST_F(ParityOpsTests, scatterND_test7) { sd::ops::scatter_nd op; auto result = op.evaluate({&indices, &updates, &shape}, {}, {}, {true, true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1218,15 +1194,15 @@ TEST_F(ParityOpsTests, scatterND_test8) { sd::ops::scatter_nd op; auto result = op.evaluate({&indices, &updates, &shape}, {}, {true}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1253,14 +1229,14 @@ TEST_F(ParityOpsTests, scatterND_add_test1) { sd::ops::scatter_nd_add op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1276,15 +1252,15 @@ TEST_F(ParityOpsTests, scatterND_add_test2) { sd::ops::scatter_nd_add op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1300,14 +1276,14 @@ TEST_F(ParityOpsTests, scatterND_add_test3) { sd::ops::scatter_nd_add op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1327,14 +1303,14 @@ TEST_F(ParityOpsTests, scatterND_add_test4) { sd::ops::scatter_nd_add op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1363,14 +1339,14 @@ TEST_F(ParityOpsTests, scatterND_add_test5) { sd::ops::scatter_nd_add op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1396,14 +1372,14 @@ TEST_F(ParityOpsTests, scatterND_sub_test1) { sd::ops::scatter_nd_sub op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1419,16 +1395,16 @@ TEST_F(ParityOpsTests, scatterND_sub_test2) { sd::ops::scatter_nd_sub op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //exp.printIndexedBuffer("e"); //z->printIndexedBuffer("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1444,14 +1420,14 @@ TEST_F(ParityOpsTests, scatterND_sub_test3) { sd::ops::scatter_nd_sub op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1471,14 +1447,14 @@ TEST_F(ParityOpsTests, scatterND_sub_test4) { sd::ops::scatter_nd_sub op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1507,14 +1483,14 @@ TEST_F(ParityOpsTests, scatterND_sub_test5) { sd::ops::scatter_nd_sub op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -1528,14 +1504,14 @@ TEST_F(ParityOpsTests, scatterND_update_test1) { sd::ops::scatter_nd_update op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1551,15 +1527,15 @@ TEST_F(ParityOpsTests, scatterND_update_test2) { sd::ops::scatter_nd_update op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1575,15 +1551,15 @@ TEST_F(ParityOpsTests, scatterND_update_test3) { sd::ops::scatter_nd_update op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1603,14 +1579,14 @@ TEST_F(ParityOpsTests, scatterND_update_test4) { sd::ops::scatter_nd_update op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } ////////////////////////////////////////////////////////////////////// @@ -1639,14 +1615,14 @@ TEST_F(ParityOpsTests, scatterND_update_test5) { sd::ops::scatter_nd_update op; auto result = op.evaluate({&input, &indices, &updates}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } //////////////////////////////////////////////////////////////////////// @@ -1673,13 +1649,13 @@ TEST_F(ParityOpsTests, scatter_update_1) { sd::ops::scatter_update op; auto results = op.evaluate({&x, &updates}, {}, {6, 1,1, 2,1,0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); // x.printBuffer(); ASSERT_TRUE(exp.isSameShape(x)); ASSERT_TRUE(exp.equalsTo(x)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1693,12 +1669,12 @@ TEST_F(ParityOpsTests, scatter_update_2) { sd::ops::scatter_update op; auto results = op.evaluate({&x, &updates}, {}, {6, 1,0, 2,1,0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); ASSERT_TRUE(exp.isSameShape(x)); ASSERT_TRUE(exp.equalsTo(x)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1712,12 +1688,12 @@ TEST_F(ParityOpsTests, scatter_update_3) { sd::ops::scatter_update op; auto results = op.evaluate({&x, &updates}, {}, {6, 2,1,2, 2,1,0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); ASSERT_TRUE(exp.isSameShape(x)); ASSERT_TRUE(exp.equalsTo(x)); - delete results; + } ////////////////////////////////////////////////////////////////////// @@ -1731,10 +1707,10 @@ TEST_F(ParityOpsTests, scatter_update_4) { sd::ops::scatter_update op; auto results = op.evaluate({&x, &updates}, {}, {6, 1,0, 2,3,0}); - ASSERT_EQ(ND4J_STATUS_OK, results->status()); + ASSERT_EQ(ND4J_STATUS_OK, results.status()); ASSERT_TRUE(exp.isSameShape(x)); ASSERT_TRUE(exp.equalsTo(x)); - delete results; + } diff --git a/libnd4j/tests_cpu/layers_tests/RNGTests.cpp b/libnd4j/tests_cpu/layers_tests/RNGTests.cpp index 5ba874ae7..64ab1781d 100644 --- a/libnd4j/tests_cpu/layers_tests/RNGTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/RNGTests.cpp @@ -260,9 +260,9 @@ TEST_F(RNGTests, Test_Gaussian_21) { auto result = op.evaluate({&x0}, {}, {}); //x0.printIndexedBuffer("X0 Normal"); //x1.printIndexedBuffer("X1 Normal"); - ASSERT_TRUE(result->status() == Status::OK()); - auto mean = result->at(0); - auto variance = result->at(1); + ASSERT_TRUE(result.status() == Status::OK()); + auto mean = result.at(0); + auto variance = result.at(1); // mean->printIndexedBuffer("Mean"); // variance->printIndexedBuffer("Variance"); @@ -270,7 +270,7 @@ TEST_F(RNGTests, Test_Gaussian_21) { ASSERT_NEAR(sd::math::nd4j_abs(mean->e(0)), 0.f, 0.2f); ASSERT_NEAR(variance->e(0), 1.0f, 0.2f); - delete result; + } #ifdef DEBUG_BUILD @@ -292,15 +292,15 @@ TEST_F(RNGTests, Test_Gaussian_22) { auto result = op.evaluate({&x0}, {}, {}); //x0.printIndexedBuffer("X0 Normal"); //x1.printIndexedBuffer("X1 Normal"); - ASSERT_TRUE(result->status() == Status::OK()); - auto mean0 = result->at(0); - auto variance0 = result->at(1); + ASSERT_TRUE(result.status() == Status::OK()); + auto mean0 = result.at(0); + auto variance0 = result.at(1); //mean0->printIndexedBuffer("Mean"); //variance0->printIndexedBuffer("Variance"); ASSERT_NEAR(sd::math::nd4j_abs(mean0->e(0)), 0.f, 1.0e-3f); ASSERT_NEAR(variance0->e(0), 1.0f, 1.e-3f); - delete result; + } TEST_F(RNGTests, Test_Gaussian_3) { @@ -413,18 +413,17 @@ TEST_F(RNGTests, Test_Truncated_21) { ASSERT_NEAR(deviation.e(0), 2.f, 0.5); sd::ops::moments op; auto result = op.evaluate({&x0}, {}, {}, {}, {}, false); - // result->at(0)->printBuffer("MEAN"); - // result->at(1)->printBuffer("VARIANCE"); - delete result; + + // result.at(0)->printBuffer("MEAN"); + // result.at(1)->printBuffer("VARIANCE"); + sd::ops::reduce_min minOp; sd::ops::reduce_max maxOp; + auto minRes = minOp.evaluate({&x1}, {}, {}, {}); auto maxRes = maxOp.evaluate({&x0}, {}, {}, {}); // minRes->at(0)->printBuffer("MIN for Truncated"); // maxRes->at(0)->printBuffer("MAX for Truncated"); - - delete minRes; - delete maxRes; } TEST_F(RNGTests, Test_Truncated_22) { @@ -460,18 +459,15 @@ TEST_F(RNGTests, Test_Truncated_22) { ASSERT_NEAR(deviation.e(0), 4.f, 0.52); sd::ops::moments op; auto result = op.evaluate({&x0}, {}, {}, {}, {}, false); - // result->at(0)->printBuffer("MEAN"); - // result->at(1)->printBuffer("VARIANCE"); - delete result; + sd::ops::reduce_min minOp; sd::ops::reduce_max maxOp; + auto minRes = minOp.evaluate({&x1}, {}, {}, {}); auto maxRes = maxOp.evaluate({&x0}, {}, {}, {}); // minRes->at(0)->printBuffer("MIN for Truncated2"); // maxRes->at(0)->printBuffer("MAX for Truncated2"); - delete minRes; - delete maxRes; } TEST_F(RNGTests, Test_Truncated_23) { @@ -509,16 +505,14 @@ TEST_F(RNGTests, Test_Truncated_23) { auto result = op.evaluate({&x0}); // result->at(0)->printBuffer("MEAN"); // result->at(1)->printBuffer("VARIANCE"); - delete result; sd::ops::reduce_min minOp; sd::ops::reduce_max maxOp; + auto minRes = minOp.evaluate({&x1}, {}, {}, {}); auto maxRes = maxOp.evaluate({&x0}, {}, {}, {}); // minRes->at(0)->printBuffer("MIN for Truncated3"); // maxRes->at(0)->printBuffer("MAX for Truncated3"); - delete minRes; - delete maxRes; } TEST_F(RNGTests, Test_Truncated_3) { @@ -568,15 +562,15 @@ TEST_F(RNGTests, Test_Uniform_2) { auto op = new sd::ops::LegacyRandomOp(0); auto result = op->execute(_rngA, {&input}, {1.0f, 2.0f}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x1.isSameShape(z)); ASSERT_TRUE(x1.equalsTo(z)); delete op; - delete result; + } TEST_F(RNGTests, Test_Gaussian_2) { @@ -588,15 +582,15 @@ TEST_F(RNGTests, Test_Gaussian_2) { auto op = new sd::ops::LegacyRandomOp(random::GaussianDistribution); auto result = op->execute(_rngA, {&input}, {1.0f, 2.0f}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x1.isSameShape(z)); ASSERT_TRUE(x1.equalsTo(z)); delete op; - delete result; + } TEST_F(RNGTests, Test_LogNorm_2) { @@ -608,15 +602,15 @@ TEST_F(RNGTests, Test_LogNorm_2) { auto op = new sd::ops::LegacyRandomOp(random::LogNormalDistribution); auto result = op->execute(_rngA, {&input}, {1.0f, 2.0f}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x1.isSameShape(z)); ASSERT_TRUE(x1.equalsTo(z)); delete op; - delete result; + } TEST_F(RNGTests, Test_TruncatedNorm_2) { @@ -628,14 +622,14 @@ TEST_F(RNGTests, Test_TruncatedNorm_2) { auto op = new sd::ops::LegacyRandomOp(random::TruncatedNormalDistribution); auto result = op->execute(_rngA, {&input}, {1.0f, 2.0f}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x1.isSameShape(z)); ASSERT_TRUE(x1.equalsTo(z)); delete op; - delete result; + } @@ -648,15 +642,15 @@ TEST_F(RNGTests, Test_Binomial_2) { auto op = new sd::ops::LegacyRandomOp(random::BinomialDistributionEx); auto result = op->execute(_rngA, {&input}, {0.5f}, {3}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x1.isSameShape(z)); ASSERT_TRUE(x1.equalsTo(z)); delete op; - delete result; + } @@ -669,15 +663,15 @@ TEST_F(RNGTests, Test_Bernoulli_2) { auto op = new sd::ops::LegacyRandomOp(random::BernoulliDistribution); auto result = op->execute(_rngA, {&input}, {0.5f}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(x1.isSameShape(z)); ASSERT_TRUE(x1.equalsTo(z)); delete op; - delete result; + } TEST_F(RNGTests, Test_GaussianDistribution_1) { @@ -687,9 +681,9 @@ TEST_F(RNGTests, Test_GaussianDistribution_1) { sd::ops::random_normal op; auto result = op.evaluate({&x}, {0.0, 1.0f}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp0.isSameShape(z)); ASSERT_FALSE(exp0.equalsTo(z)); @@ -698,7 +692,7 @@ TEST_F(RNGTests, Test_GaussianDistribution_1) { ASSERT_FALSE(nexp1->equalsTo(z)); ASSERT_FALSE(nexp2->equalsTo(z)); - delete result; + } TEST_F(RNGTests, Test_BernoulliDistribution_1) { @@ -708,9 +702,9 @@ TEST_F(RNGTests, Test_BernoulliDistribution_1) { sd::ops::random_bernoulli op; auto result = op.evaluate({&x}, {0.5f}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_FALSE(exp0.equalsTo(z)); @@ -718,7 +712,7 @@ TEST_F(RNGTests, Test_BernoulliDistribution_1) { ASSERT_FALSE(nexp1->equalsTo(z)); ASSERT_FALSE(nexp2->equalsTo(z)); - delete result; + } @@ -729,9 +723,9 @@ TEST_F(RNGTests, Test_ExponentialDistribution_1) { sd::ops::random_exponential op; auto result = op.evaluate({&x}, {0.25f}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp0.isSameShape(z)); ASSERT_FALSE(exp0.equalsTo(z)); @@ -740,7 +734,7 @@ TEST_F(RNGTests, Test_ExponentialDistribution_1) { ASSERT_FALSE(nexp1->equalsTo(z)); ASSERT_FALSE(nexp2->equalsTo(z)); - delete result; + } TEST_F(RNGTests, Test_ExponentialDistribution_2) { @@ -753,9 +747,9 @@ TEST_F(RNGTests, Test_ExponentialDistribution_2) { sd::ops::random_exponential op; auto result = op.evaluate({&x, &y}, {0.25f}, {0}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp0.isSameShape(z)); ASSERT_FALSE(exp0.equalsTo(z)); @@ -764,7 +758,7 @@ TEST_F(RNGTests, Test_ExponentialDistribution_2) { ASSERT_FALSE(nexp1->equalsTo(z)); ASSERT_FALSE(nexp2->equalsTo(z)); - delete result; + } TEST_F(RNGTests, Test_PoissonDistribution_1) { @@ -777,14 +771,14 @@ TEST_F(RNGTests, Test_PoissonDistribution_1) { sd::ops::random_poisson op; auto result = op.evaluate({&x, &la}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Poisson distribution"); ASSERT_TRUE(exp0.isSameShape(z)); ASSERT_FALSE(exp0.equalsTo(z)); - delete result; + } TEST_F(RNGTests, Test_GammaDistribution_1) { @@ -797,14 +791,14 @@ TEST_F(RNGTests, Test_GammaDistribution_1) { sd::ops::random_gamma op; auto result = op.evaluate({&x, &al}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Gamma distribution"); ASSERT_TRUE(exp0.isSameShape(z)); ASSERT_FALSE(exp0.equalsTo(z)); - delete result; + } TEST_F(RNGTests, Test_GammaDistribution_2) { @@ -818,14 +812,14 @@ TEST_F(RNGTests, Test_GammaDistribution_2) { sd::ops::random_gamma op; auto result = op.evaluate({&x, &al, &be}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Gamma distribution"); ASSERT_TRUE(exp0.isSameShape(z)); ASSERT_FALSE(exp0.equalsTo(z)); - delete result; + } TEST_F(RNGTests, Test_GammaDistribution_3) { @@ -839,14 +833,14 @@ TEST_F(RNGTests, Test_GammaDistribution_3) { sd::ops::random_gamma op; auto result = op.evaluate({&x, &al, &be}, {}, {}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer("Gamma distribution"); ASSERT_TRUE(exp0.isSameShape(z)); ASSERT_FALSE(exp0.equalsTo(z)); - delete result; + } TEST_F(RNGTests, Test_UniformDistribution_04) { @@ -858,13 +852,13 @@ TEST_F(RNGTests, Test_UniformDistribution_04) { sd::ops::randomuniform op; auto result = op.evaluate({&x, &al, &be}, {}, {DataType::INT32}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp0.isSameShape(z)); ASSERT_FALSE(exp0.equalsTo(z)); - delete result; + } namespace sd { @@ -1021,12 +1015,12 @@ TEST_F(RNGTests, test_multinomial_1) { NDArray expectedZ('c', { 3, 3 }, { 0., 0, 0, 0, 0, 0, 0, 0, 0 }, sd::DataType::INT64); auto result = op.evaluate({ &probsZ, &samples }, { }, { 1, INT64 }); - auto outputZ = result->at(0); + auto outputZ = result.at(0); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); ASSERT_TRUE(expectedZ.isSameShape(outputZ)); ASSERT_TRUE(expectedZ.equalsTo(outputZ)); - delete result; + } TEST_F(RNGTests, test_multinomial_2) { @@ -1117,8 +1111,8 @@ TEST_F(RNGTests, test_multinomial_5) { } auto resultR = op.evaluate({ &probs, &samples }, { }, { 1 }); - auto outputR = resultR->at(0); - ASSERT_EQ(Status::OK(), resultR->status()); + auto outputR = resultR.at(0); + ASSERT_EQ(Status::OK(), resultR.status()); deviation = outputR->varianceNumber(variance::SummaryStatsStandardDeviation, false); mean = outputR->meanNumber(); @@ -1131,7 +1125,6 @@ TEST_F(RNGTests, test_multinomial_5) { ASSERT_TRUE(value >= 0 && value < ClassValue); } - delete resultR; } @@ -1150,8 +1143,8 @@ TEST_F(RNGTests, test_multinomial_6) { NDArray probsR('c', { batchValue, ClassValue }, { 1., 1.5, 2., 2.5, 3. }, sd::DataType::FLOAT32); auto resultR = op.evaluate({ &probsR, &samples }, { }, { 0 }); - auto outputR = resultR->at(0); - ASSERT_EQ(Status::OK(), resultR->status()); + auto outputR = resultR.at(0); + ASSERT_EQ(Status::OK(), resultR.status()); NDArray countsR('c', { ClassValue }, { 0., 0, 0, 0, 0 }, sd::DataType::DOUBLE); @@ -1175,7 +1168,7 @@ TEST_F(RNGTests, test_multinomial_6) { ASSERT_NEAR(1.2175, deviation.e(0), 45e-3); // 1000000 35e-3); ASSERT_NEAR(2.906, mean.e(0), 45e-3); // 1000000 35e-3); - delete resultR; + RandomGenerator rng(1234, 1234); NDArray probs('c', { batchValue, ClassValue }, { 1., 1.5, 2., 2.5, 3. }, sd::DataType::FLOAT32); diff --git a/libnd4j/tests_cpu/layers_tests/ScalarTests.cpp b/libnd4j/tests_cpu/layers_tests/ScalarTests.cpp index a3c709ec7..898af1722 100644 --- a/libnd4j/tests_cpu/layers_tests/ScalarTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/ScalarTests.cpp @@ -96,14 +96,14 @@ TEST_F(ScalarTests, Test_Concat_1) { sd::ops::concat op; auto result = op.evaluate({&t, &u, &v}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -116,15 +116,15 @@ TEST_F(ScalarTests, Test_Concat_2) { sd::ops::concat op; auto result = op.evaluate({&t, &u, &v}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); // z->printIndexedBuffer(); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -137,16 +137,16 @@ TEST_F(ScalarTests, Test_Concat_3) { sd::ops::concat op; auto result = op.evaluate({&t, &u, &v}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); //z->printShapeInfo("z"); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ScalarTests, Test_ExpandDims_1) { @@ -156,14 +156,14 @@ TEST_F(ScalarTests, Test_ExpandDims_1) { sd::ops::expand_dims op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ScalarTests, Test_Squeeze_1) { @@ -172,14 +172,14 @@ TEST_F(ScalarTests, Test_Squeeze_1) { sd::ops::squeeze op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -189,14 +189,14 @@ TEST_F(ScalarTests, Test_Reshape_1) { sd::ops::reshape op; auto result = op.evaluate({&x}, {}, {-99, 1, 1, 1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -206,14 +206,14 @@ TEST_F(ScalarTests, Test_Permute_1) { sd::ops::permute op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(ScalarTests, Test_Concat_Scalar_1) { @@ -225,14 +225,13 @@ TEST_F(ScalarTests, Test_Concat_Scalar_1) { sd::ops::concat op; auto result = op.evaluate({&t, &u, &v, &w}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } @@ -245,12 +244,11 @@ TEST_F(ScalarTests, Test_Concat_Scalar_2) { sd::ops::concat op; auto result = op.evaluate({&t, &u, &v, &w}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } \ No newline at end of file diff --git a/libnd4j/tests_cpu/layers_tests/ShapeTests.cpp b/libnd4j/tests_cpu/layers_tests/ShapeTests.cpp index c6ab40b76..46edc50d8 100644 --- a/libnd4j/tests_cpu/layers_tests/ShapeTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/ShapeTests.cpp @@ -308,14 +308,13 @@ TEST_F(ShapeTests, Tests_Transpose_119_2) { sd::ops::transpose op; auto result = op.evaluate({&x}); - ASSERT_EQ(Status::OK(), result->status()); + ASSERT_EQ(Status::OK(), result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; } TEST_F(ShapeTests, Tests_Transpose_119_3) { diff --git a/libnd4j/tests_cpu/layers_tests/SingleDimTests.cpp b/libnd4j/tests_cpu/layers_tests/SingleDimTests.cpp index 31104d7b5..636206957 100644 --- a/libnd4j/tests_cpu/layers_tests/SingleDimTests.cpp +++ b/libnd4j/tests_cpu/layers_tests/SingleDimTests.cpp @@ -70,14 +70,14 @@ TEST_F(SingleDimTests, Test_Concat_1) { sd::ops::concat op; auto result = op.evaluate({&x, &y}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(SingleDimTests, Test_Reduce_1) { @@ -104,14 +104,14 @@ TEST_F(SingleDimTests, Test_ExpandDims_1) { sd::ops::expand_dims op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -122,14 +122,14 @@ TEST_F(SingleDimTests, Test_ExpandDims_2) { sd::ops::expand_dims op; auto result = op.evaluate({&x}, {}, {1}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -142,14 +142,14 @@ TEST_F(SingleDimTests, Test_Squeeze_1) { sd::ops::squeeze op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_EQ(exp.rankOf(), z->rankOf()); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(SingleDimTests, Test_Squeeze_2) { @@ -158,14 +158,14 @@ TEST_F(SingleDimTests, Test_Squeeze_2) { sd::ops::squeeze op; auto result = op.evaluate({&x}, {}, {}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(SingleDimTests, Test_Reshape_1) { @@ -174,14 +174,14 @@ TEST_F(SingleDimTests, Test_Reshape_1) { sd::ops::reshape op; auto result = op.evaluate({&x}, {}, {-99, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } TEST_F(SingleDimTests, Test_Reshape_2) { @@ -190,14 +190,14 @@ TEST_F(SingleDimTests, Test_Reshape_2) { sd::ops::reshape op; auto result = op.evaluate({&x}, {}, {-99, 1, 3}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } @@ -207,12 +207,12 @@ TEST_F(SingleDimTests, Test_Permute_1) { sd::ops::permute op; auto result = op.evaluate({&x}, {}, {0}); - ASSERT_EQ(ND4J_STATUS_OK, result->status()); + ASSERT_EQ(ND4J_STATUS_OK, result.status()); - auto z = result->at(0); + auto z = result.at(0); ASSERT_TRUE(exp.isSameShape(z)); ASSERT_TRUE(exp.equalsTo(z)); - delete result; + } \ No newline at end of file