Add log unittest.
This commit is contained in:
@@ -270,3 +270,27 @@ TEST_F(Function1D_Cuda_Test, repmat)
|
||||
EXPECT_EQ(result1[i], result2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(Function1D_Cuda_Test, log)
|
||||
{
|
||||
Aurora::Matrix hostMatrix = Aurora::Matrix::fromRawData(new float[8]{1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8}, 2,4);
|
||||
Aurora::CudaMatrix deviceMatrix = hostMatrix.toDeviceMatrix();
|
||||
|
||||
auto result1 = Aurora::log(hostMatrix);
|
||||
auto result2 = Aurora::log(deviceMatrix).toHostMatrix();
|
||||
EXPECT_EQ(result2.getDataSize(), result1.getDataSize());
|
||||
EXPECT_EQ(result2.getValueType(), result1.getValueType());
|
||||
for(size_t i=0; i<result1.getDataSize() * result1.getValueType(); ++i)
|
||||
{
|
||||
EXPECT_FLOAT_AE(result1[i], result2[i]);
|
||||
}
|
||||
|
||||
result1 = Aurora::log(hostMatrix,3);
|
||||
result2 = Aurora::log(deviceMatrix,3).toHostMatrix();
|
||||
EXPECT_EQ(result2.getDataSize(), result1.getDataSize());
|
||||
EXPECT_EQ(result2.getValueType(), result1.getValueType());
|
||||
for(size_t i=0; i<result1.getDataSize() * result1.getValueType(); ++i)
|
||||
{
|
||||
EXPECT_FLOAT_AE(result1[i], result2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user