Reformatted
This commit is contained in:
parent
c5df89c17b
commit
fdc1d3b91a
23 changed files with 455 additions and 418 deletions
|
|
@ -3,34 +3,33 @@
|
|||
|
||||
#include "kompute/Kompute.hpp"
|
||||
|
||||
TEST(TestTensor, ConstructorData) {
|
||||
std::vector<float> vec{0,1,2};
|
||||
TEST(TestTensor, ConstructorData)
|
||||
{
|
||||
std::vector<float> vec{ 0, 1, 2 };
|
||||
kp::Tensor tensor(vec);
|
||||
EXPECT_EQ( tensor.size(), vec.size() );
|
||||
EXPECT_EQ( tensor.data(), vec );
|
||||
EXPECT_EQ(tensor.size(), vec.size());
|
||||
EXPECT_EQ(tensor.data(), vec);
|
||||
}
|
||||
|
||||
TEST(TestTensor, CopyFromHostData) {
|
||||
std::vector<float> vecA{0,1,2};
|
||||
std::vector<float> vecB{0,0,0};
|
||||
TEST(TestTensor, CopyFromHostData)
|
||||
{
|
||||
std::vector<float> vecA{ 0, 1, 2 };
|
||||
std::vector<float> vecB{ 0, 0, 0 };
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA = std::make_shared<kp::Tensor>(
|
||||
vecA,
|
||||
kp::Tensor::TensorTypes::eStaging);
|
||||
std::shared_ptr<kp::Tensor> tensorB = std::make_shared<kp::Tensor>(
|
||||
vecB,
|
||||
kp::Tensor::TensorTypes::eStaging);
|
||||
std::shared_ptr<kp::Tensor> tensorA =
|
||||
std::make_shared<kp::Tensor>(vecA, kp::Tensor::TensorTypes::eStaging);
|
||||
std::shared_ptr<kp::Tensor> tensorB =
|
||||
std::make_shared<kp::Tensor>(vecB, kp::Tensor::TensorTypes::eStaging);
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
if(std::shared_ptr<kp::Sequence> sq =
|
||||
mgr.getOrCreateManagedSequence("new").lock())
|
||||
{
|
||||
if (std::shared_ptr<kp::Sequence> sq =
|
||||
mgr.getOrCreateManagedSequence("new").lock()) {
|
||||
sq->begin();
|
||||
|
||||
sq->record<kp::OpTensorCreate>({tensorA, tensorB});
|
||||
sq->record<kp::OpTensorCreate>({ tensorA, tensorB });
|
||||
|
||||
sq->record<kp::OpTensorCopy>({tensorA, tensorB});
|
||||
sq->record<kp::OpTensorCopy>({ tensorA, tensorB });
|
||||
|
||||
sq->end();
|
||||
|
||||
|
|
@ -39,4 +38,3 @@ TEST(TestTensor, CopyFromHostData) {
|
|||
|
||||
EXPECT_EQ(tensorA->data(), tensorB->data());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue