2023-10-10 15:21:13 +08:00
|
|
|
#include "core/graph.h"
|
|
|
|
#include "core/kernel.h"
|
|
|
|
#include "core/runtime.h"
|
|
|
|
#include "operators/unary.h"
|
|
|
|
|
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
namespace infini {
|
|
|
|
|
|
|
|
using ExpectOutput = vector<float>;
|
|
|
|
TEST(Unary, ShapeInference) {
|
|
|
|
Runtime runtime = NativeCpuRuntimeObj::getInstance();
|
|
|
|
{
|
|
|
|
Graph g = make_ref<GraphObj>(runtime);
|
|
|
|
Tensor i0 = g->addTensor({2}, DataType::Float32);
|
2024-01-15 11:02:13 +08:00
|
|
|
auto op = g->addOp<CastObj>(i0, nullptr, CastType::Float2Float16);
|
2023-10-10 15:21:13 +08:00
|
|
|
EXPECT_EQ(op->getOutput()->getDims(), (Shape{2}));
|
2024-01-15 11:02:13 +08:00
|
|
|
EXPECT_EQ(op->getOutDType(), (DataType::Float16));
|
2023-10-10 15:21:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace infini
|