Eliminated memory leaks and dropped waste prints with tests. (#117)
parent
f083b96c74
commit
3c7cd2397c
|
@ -45,7 +45,7 @@ namespace nd4j {
|
||||||
|
|
||||||
DECLARE_SHAPE_FN(to_double) {
|
DECLARE_SHAPE_FN(to_double) {
|
||||||
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::DOUBLE, true, block.workspace());
|
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::DOUBLE, true, block.workspace());
|
||||||
return SHAPELIST(outShape);
|
return SHAPELIST(CONSTANT(outShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace nd4j {
|
||||||
|
|
||||||
DECLARE_SHAPE_FN(to_float16) {
|
DECLARE_SHAPE_FN(to_float16) {
|
||||||
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::HALF, true, block.workspace());
|
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::HALF, true, block.workspace());
|
||||||
return SHAPELIST(outShape);
|
return SHAPELIST(CONSTANT(outShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace nd4j {
|
||||||
|
|
||||||
DECLARE_SHAPE_FN(to_float32) {
|
DECLARE_SHAPE_FN(to_float32) {
|
||||||
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::FLOAT32, true, block.workspace());
|
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::FLOAT32, true, block.workspace());
|
||||||
return SHAPELIST(outShape);
|
return SHAPELIST(CONSTANT(outShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace nd4j {
|
||||||
}
|
}
|
||||||
DECLARE_SHAPE_FN(to_int32) {
|
DECLARE_SHAPE_FN(to_int32) {
|
||||||
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::INT32, true, block.workspace());
|
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::INT32, true, block.workspace());
|
||||||
return SHAPELIST(outShape);
|
return SHAPELIST(CONSTANT(outShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace nd4j {
|
||||||
}
|
}
|
||||||
DECLARE_SHAPE_FN(to_int64) {
|
DECLARE_SHAPE_FN(to_int64) {
|
||||||
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::INT64, true, block.workspace());
|
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::INT64, true, block.workspace());
|
||||||
return SHAPELIST(outShape);
|
return SHAPELIST(CONSTANT(outShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace nd4j {
|
||||||
}
|
}
|
||||||
DECLARE_SHAPE_FN(to_uint32) {
|
DECLARE_SHAPE_FN(to_uint32) {
|
||||||
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::UINT32, true, block.workspace());
|
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::UINT32, true, block.workspace());
|
||||||
return SHAPELIST(outShape);
|
return SHAPELIST(CONSTANT(outShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace nd4j {
|
||||||
}
|
}
|
||||||
DECLARE_SHAPE_FN(to_uint64) {
|
DECLARE_SHAPE_FN(to_uint64) {
|
||||||
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::UINT64, true, block.workspace());
|
auto outShape = ShapeBuilders::copyShapeInfoAndType(inputShape->at(0), DataType::UINT64, true, block.workspace());
|
||||||
return SHAPELIST(outShape);
|
return SHAPELIST(CONSTANT(outShape));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ DECLARE_SHAPE_FN(mergemaxindex) {
|
||||||
dtype = (DataType)INT_ARG(0);
|
dtype = (DataType)INT_ARG(0);
|
||||||
|
|
||||||
auto resShape = ShapeBuilders::copyShapeInfoAndType(in, dtype, block.workspace());
|
auto resShape = ShapeBuilders::copyShapeInfoAndType(in, dtype, block.workspace());
|
||||||
return SHAPELIST(resShape);
|
return SHAPELIST(CONSTANT(resShape));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1570,8 +1570,8 @@ TEST_F(DeclarableOpsTests6, LogDet_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("LogDet Output1 ");
|
// z->printIndexedBuffer("LogDet Output1 ");
|
||||||
exp.printIndexedBuffer("LogDet Expected1 ");
|
// exp.printIndexedBuffer("LogDet Expected1 ");
|
||||||
|
|
||||||
ASSERT_TRUE(exp.isSameShape(z));
|
ASSERT_TRUE(exp.isSameShape(z));
|
||||||
ASSERT_TRUE(exp.equalsTo(z));
|
ASSERT_TRUE(exp.equalsTo(z));
|
||||||
|
@ -1592,9 +1592,9 @@ TEST_F(DeclarableOpsTests6, LogDet_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);
|
||||||
z->printIndexedBuffer("LogDet Output2 ");
|
// z->printIndexedBuffer("LogDet Output2 ");
|
||||||
// z->printShapeInfo("Shape");
|
// z->printShapeInfo("Shape");
|
||||||
exp.printIndexedBuffer("LogDet Expected2 ");
|
// exp.printIndexedBuffer("LogDet Expected2 ");
|
||||||
|
|
||||||
ASSERT_TRUE(exp.isSameShape(z));
|
ASSERT_TRUE(exp.isSameShape(z));
|
||||||
ASSERT_TRUE(exp.equalsTo(z));
|
ASSERT_TRUE(exp.equalsTo(z));
|
||||||
|
@ -1615,9 +1615,9 @@ TEST_F(DeclarableOpsTests6, LogDet_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("LogDet Output3 ");
|
// z->printIndexedBuffer("LogDet Output3 ");
|
||||||
// z->printShapeInfo("Shape");
|
// z->printShapeInfo("Shape");
|
||||||
exp.printIndexedBuffer("LogDet Expected3 ");
|
// exp.printIndexedBuffer("LogDet Expected3 ");
|
||||||
|
|
||||||
ASSERT_TRUE(exp.isSameShape(z));
|
ASSERT_TRUE(exp.isSameShape(z));
|
||||||
ASSERT_TRUE(exp.equalsTo(z));
|
ASSERT_TRUE(exp.equalsTo(z));
|
||||||
|
@ -1662,8 +1662,8 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_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("Output ");
|
// z->printIndexedBuffer("Output ");
|
||||||
exp.printIndexedBuffer("Expected ");
|
// exp.printIndexedBuffer("Expected ");
|
||||||
|
|
||||||
ASSERT_TRUE(exp.isSameShape(z));
|
ASSERT_TRUE(exp.isSameShape(z));
|
||||||
ASSERT_TRUE(exp.equalsTo(z));
|
ASSERT_TRUE(exp.equalsTo(z));
|
||||||
|
@ -1698,8 +1698,8 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_01) {
|
||||||
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->printIndexedBuffer("Output ");
|
||||||
exp.printIndexedBuffer("Expected ");
|
// exp.printIndexedBuffer("Expected ");
|
||||||
|
|
||||||
ASSERT_TRUE(exp.isSameShape(z));
|
ASSERT_TRUE(exp.isSameShape(z));
|
||||||
ASSERT_TRUE(exp.equalsTo(z));
|
ASSERT_TRUE(exp.equalsTo(z));
|
||||||
|
@ -1732,8 +1732,8 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_02) {
|
||||||
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->printIndexedBuffer("Output ");
|
||||||
exp.printIndexedBuffer("Expected ");
|
// exp.printIndexedBuffer("Expected ");
|
||||||
|
|
||||||
ASSERT_TRUE(exp.isSameShape(z));
|
ASSERT_TRUE(exp.isSameShape(z));
|
||||||
ASSERT_TRUE(exp.equalsTo(z));
|
ASSERT_TRUE(exp.equalsTo(z));
|
||||||
|
@ -1812,8 +1812,8 @@ TEST_F(DeclarableOpsTests6, MatrixInverse_03) {
|
||||||
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->printIndexedBuffer("Output ");
|
||||||
exp.printIndexedBuffer("Expected ");
|
// exp.printIndexedBuffer("Expected ");
|
||||||
|
|
||||||
ASSERT_TRUE(exp.isSameShape(z));
|
ASSERT_TRUE(exp.isSameShape(z));
|
||||||
ASSERT_TRUE(exp.equalsTo(z));
|
ASSERT_TRUE(exp.equalsTo(z));
|
||||||
|
|
|
@ -105,6 +105,7 @@ TEST_F(ListOperationsTests, BasicTest_UnStackList_1) {
|
||||||
auto row = list.read(e);
|
auto row = list.read(e);
|
||||||
ASSERT_TRUE(row->equalsTo(tads->at(e)));
|
ASSERT_TRUE(row->equalsTo(tads->at(e)));
|
||||||
//list.write(e, row);
|
//list.write(e, row);
|
||||||
|
delete row;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
|
@ -248,8 +248,8 @@ TEST_F(RNGTests, Test_Gaussian_21) {
|
||||||
RandomLauncher::fillGaussian(LaunchContext::defaultContext(), _rngA, &x0, 0.0f, 1.0f);
|
RandomLauncher::fillGaussian(LaunchContext::defaultContext(), _rngA, &x0, 0.0f, 1.0f);
|
||||||
RandomLauncher::fillGaussian(LaunchContext::defaultContext(), _rngB, &x1, 0.0f, 1.0f);
|
RandomLauncher::fillGaussian(LaunchContext::defaultContext(), _rngB, &x1, 0.0f, 1.0f);
|
||||||
|
|
||||||
x0.printIndexedBuffer("x0");
|
// x0.printIndexedBuffer("x0");
|
||||||
x1.printIndexedBuffer("x1");
|
// x1.printIndexedBuffer("x1");
|
||||||
ASSERT_TRUE(x0.equalsTo(&x1));
|
ASSERT_TRUE(x0.equalsTo(&x1));
|
||||||
|
|
||||||
ASSERT_FALSE(x0.equalsTo(nexp0));
|
ASSERT_FALSE(x0.equalsTo(nexp0));
|
||||||
|
|
Loading…
Reference in New Issue