MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / TEST

Function TEST

test/cpp/phi/api/test_scale_benchmark.cc:31–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29namespace tests {
30
31TEST(API, scale) {
32 auto x = experimental::full({3, 4}, 1.0, phi::DataType::FLOAT32, CPUPlace());
33
34 const size_t cycles = 300;
35 phi::tests::Timer timer;
36 double t1{}, t2{}, t3{};
37
38 for (size_t i = 0; i < cycles; ++i) {
39 timer.tic();
40 for (size_t i = 0; i < cycles; ++i) {
41 auto out = experimental::scale_kernel_context(x, 2.0, 1.0, true);
42 }
43 t1 += timer.toc();
44
45 timer.tic();
46 for (size_t i = 0; i < cycles; ++i) {
47 auto out = experimental::scale(x, 2.0, 1.0, true);
48 }
49 t2 += timer.toc();
50
51 timer.tic();
52 for (size_t i = 0; i < cycles; ++i) {
53 auto out = experimental::scale_switch_case(x, 2.0, 1.0, true);
54 }
55 t3 += timer.toc();
56 }
57
58 LOG(INFO) << "The cost of kernel_context is " << t1 << "ms.";
59 LOG(INFO) << "The cost of variadic_args_kernel_fn is " << t2 << "ms.";
60 LOG(INFO) << "The cost of switch_case is " << t3 << "ms.";
61}
62
63} // namespace tests
64} // namespace paddle

Callers

nothing calls this directly

Calls 7

scale_kernel_contextFunction · 0.85
scale_switch_caseFunction · 0.85
fullFunction · 0.50
CPUPlaceClass · 0.50
scaleFunction · 0.50
ticMethod · 0.45
tocMethod · 0.45

Tested by

no test coverage detected