2022-09-29 14:44:20 +08:00
|
|
|
#include "core/graph.h"
|
|
|
|
#include "core/kernel.h"
|
|
|
|
#include "core/runtime.h"
|
|
|
|
#include "operators/gather.h"
|
|
|
|
|
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
namespace infini {
|
|
|
|
|
|
|
|
TEST(Gather, ShapeInference) {
|
2023-03-27 21:28:49 +08:00
|
|
|
Runtime runtime = NativeCpuRuntimeObj::getInstance();
|
2022-09-29 14:44:20 +08:00
|
|
|
|
|
|
|
Graph g = make_ref<GraphObj>(runtime);
|
2023-08-18 12:17:47 +08:00
|
|
|
Tensor i = g->addTensor({1, 3, 4, 4}, DataType::Int32);
|
|
|
|
Tensor index = g->addTensor({2, 1, 2}, DataType::Int32);
|
2022-09-29 14:44:20 +08:00
|
|
|
auto op = g->addOp<GatherObj>(i, index, nullptr, 1);
|
|
|
|
EXPECT_EQ(op->getOutput()->getDims(), (Shape{1, 2, 1, 2, 4, 4}));
|
|
|
|
}
|
2022-10-15 16:29:28 +08:00
|
|
|
} // namespace infini
|