ONE - On-device Neural Engine
Loading...
Searching...
No Matches
TensorVariant.cpp File Reference
#include "mir/TensorVariant.h"
#include <gtest/gtest.h>

Go to the source code of this file.

Functions

 TEST (TensorVariant, BasicTest)
 
 TEST (TensorVariant, ElementSizeDeductionTest)
 

Function Documentation

◆ TEST() [1/2]

TEST ( TensorVariant  ,
BasicTest   
)

Definition at line 23 of file TensorVariant.cpp.

24{
25 Shape shape{2, 2};
26 TensorVariant t(DataType::FLOAT32, shape);
27
28 ASSERT_EQ(t.getShape(), shape);
29 ASSERT_EQ(t.getOffset({0, 0}), 0u);
30}
Definition Shape.h:28

References mir::TensorVariant::getOffset(), and mir::TensorVariant::getShape().

◆ TEST() [2/2]

TEST ( TensorVariant  ,
ElementSizeDeductionTest   
)

Definition at line 32 of file TensorVariant.cpp.

33{
34 Shape shape{2, 2, 2};
35 TensorVariant t(DataType::FLOAT32, shape);
36
37 ASSERT_EQ(t.getElementSize(), sizeof(float));
38 ASSERT_EQ((float *)t.at({1, 1, 1}), (float *)t.at({0, 0, 0}) + 7);
39}

References mir::TensorVariant::at(), and mir::TensorVariant::getElementSize().