Working implementation with tests
This commit is contained in:
parent
cf7d46cd23
commit
f02b9d6915
21 changed files with 297 additions and 216 deletions
|
|
@ -7,9 +7,9 @@ TEST(TestManager, EndToEndOpMultEvalFlow)
|
|||
{
|
||||
kp::Manager mgr;
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorLHS = mgr.tensor({ 0, 1, 2 });
|
||||
std::shared_ptr<kp::Tensor> tensorRHS = mgr.tensor({ 2, 4, 6 });
|
||||
std::shared_ptr<kp::Tensor> tensorOutput = mgr.tensor({ 0, 0, 0 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorLHS = mgr.tensor({ 0, 1, 2 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorRHS = mgr.tensor({ 2, 4, 6 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorOutput = mgr.tensor({ 0, 0, 0 });
|
||||
|
||||
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorLHS,
|
||||
tensorRHS,
|
||||
|
|
@ -20,16 +20,16 @@ TEST(TestManager, EndToEndOpMultEvalFlow)
|
|||
->eval<kp::OpMult>(params, mgr.algorithm())
|
||||
->eval<kp::OpTensorSyncLocal>(params);
|
||||
|
||||
EXPECT_EQ(tensorOutput->data(), std::vector<float>({ 0, 4, 12 }));
|
||||
EXPECT_EQ(tensorOutput->vector(), std::vector<float>({ 0, 4, 12 }));
|
||||
}
|
||||
|
||||
TEST(TestManager, EndToEndOpMultSeqFlow)
|
||||
{
|
||||
kp::Manager mgr;
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorLHS = mgr.tensor({ 0, 1, 2 });
|
||||
std::shared_ptr<kp::Tensor> tensorRHS = mgr.tensor({ 2, 4, 6 });
|
||||
std::shared_ptr<kp::Tensor> tensorOutput = mgr.tensor({ 0, 0, 0 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorLHS = mgr.tensor({ 0, 1, 2 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorRHS = mgr.tensor({ 2, 4, 6 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorOutput = mgr.tensor({ 0, 0, 0 });
|
||||
|
||||
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorLHS,
|
||||
tensorRHS,
|
||||
|
|
@ -41,16 +41,16 @@ TEST(TestManager, EndToEndOpMultSeqFlow)
|
|||
->record<kp::OpTensorSyncLocal>(params)
|
||||
->eval();
|
||||
|
||||
EXPECT_EQ(tensorOutput->data(), std::vector<float>({ 0, 4, 12 }));
|
||||
EXPECT_EQ(tensorOutput->vector(), std::vector<float>({ 0, 4, 12 }));
|
||||
}
|
||||
|
||||
TEST(TestManager, TestMultipleSequences)
|
||||
{
|
||||
kp::Manager mgr;
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorLHS = mgr.tensor({ 0, 1, 2 });
|
||||
std::shared_ptr<kp::Tensor> tensorRHS = mgr.tensor({ 2, 4, 6 });
|
||||
std::shared_ptr<kp::Tensor> tensorOutput = mgr.tensor({ 0, 0, 0 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorLHS = mgr.tensor({ 0, 1, 2 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorRHS = mgr.tensor({ 2, 4, 6 });
|
||||
std::shared_ptr<kp::TensorT<float>> tensorOutput = mgr.tensor({ 0, 0, 0 });
|
||||
|
||||
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorLHS,
|
||||
tensorRHS,
|
||||
|
|
@ -60,5 +60,5 @@ TEST(TestManager, TestMultipleSequences)
|
|||
mgr.sequence()->eval<kp::OpMult>(params, mgr.algorithm());
|
||||
mgr.sequence()->eval<kp::OpTensorSyncLocal>(params);
|
||||
|
||||
EXPECT_EQ(tensorOutput->data(), std::vector<float>({ 0, 4, 12 }));
|
||||
EXPECT_EQ(tensorOutput->vector(), std::vector<float>({ 0, 4, 12 }));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue