#include "bang/bang_runtime.h" #include "core/graph.h" #include "core/kernel.h" #include "core/runtime.h" #include "operators/unary.h" #include "test.h" namespace infini { template void testTrigon(const std::function &generator, const Shape &shape) { // Runtime Runtime cpuRuntime = NativeCpuRuntimeObj::getInstance(); auto bangRuntime = make_ref(); // Build input data on CPU Tensor inputCpu = make_ref(shape, DataType::Float32, cpuRuntime); inputCpu->dataMalloc(); inputCpu->setData(generator); // GPU Graph bangGraph = make_ref(bangRuntime); auto inputGpu = bangGraph->cloneTensor(inputCpu); auto gpuOp = bangGraph->addOp(inputGpu, nullptr); bangGraph->dataMalloc(); bangRuntime->run(bangGraph); auto outputGpu = gpuOp->getOutput(); auto outputGpu2Cpu = outputGpu->clone(cpuRuntime); // CPU inputCpu->printData(); outputGpu2Cpu->printData(); EXPECT_TRUE(1); } TEST(cnnl_Trigon, run) { testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); testTrigon(IncrementalGenerator(), Shape{1, 1, 2, 3}); } } // namespace infini