| 62 | using DenseTensor = phi::DenseTensor; |
| 63 | |
| 64 | std::vector<Tensor> PrepareInputs(const phi::Place& place) { |
| 65 | phi::DeviceContextPool& pool = phi::DeviceContextPool::Instance(); |
| 66 | auto& dev_ctx = *pool.Get(place); |
| 67 | |
| 68 | DenseTensor t; |
| 69 | t.Resize(common::make_ddim({2, 4})); |
| 70 | t.mutable_data<float>(place); |
| 71 | phi::funcs::set_constant(dev_ctx, &t, static_cast<float>(2.)); |
| 72 | |
| 73 | return utils::ToTensors({t}); |
| 74 | } |
| 75 | |
| 76 | TEST(CpuLayerTest, Function) { |
| 77 | auto func_null = Function(); |