| 1107 | BM_MaxPoolFwdCPU(32, 14, 14, 576, 3, 3, 2, SAME, 4, "maxpool10_SAME"); |
| 1108 | |
| 1109 | static void BM_MaxPoolBk(int iters, int batch_size, int rows, int cols, |
| 1110 | int depth, int kernel_rows, int kernel_cols, |
| 1111 | int stride, Padding padding, int num_threads, |
| 1112 | bool use_gpu, const string& label) { |
| 1113 | auto root = Scope::NewRootScope().ExitOnError(); |
| 1114 | |
| 1115 | int64 out_height, out_width, pad_rows, pad_cols; |
| 1116 | TF_CHECK_OK(GetWindowedOutputSize(rows, kernel_rows, stride, padding, |
| 1117 | &out_height, &pad_rows)); |
| 1118 | TF_CHECK_OK(GetWindowedOutputSize(cols, kernel_cols, stride, padding, |
| 1119 | &out_width, &pad_cols)); |
| 1120 | |
| 1121 | Tensor input_data(DT_FLOAT, TensorShape({batch_size, rows, cols, depth})); |
| 1122 | input_data.flat<float>().setRandom(); |
| 1123 | |
| 1124 | Tensor output_data(DT_FLOAT, |
| 1125 | TensorShape({batch_size, out_height, out_width, depth})); |
| 1126 | output_data.flat<float>().setRandom(); |
| 1127 | |
| 1128 | Tensor output_diff(DT_FLOAT, |
| 1129 | TensorShape({batch_size, out_height, out_width, depth})); |
| 1130 | output_diff.flat<float>().setRandom(); |
| 1131 | |
| 1132 | CHECK_EQ(kernel_rows, kernel_cols); |
| 1133 | ops::internal::MaxPoolGrad(root, input_data, output_data, output_diff, |
| 1134 | {1, kernel_rows, kernel_cols, 1} /* ksize */, |
| 1135 | {1, stride, stride, 1} /* stride */, |
| 1136 | padding == VALID ? "VALID" : "SAME"); |
| 1137 | TF_CHECK_OK(root.status()); |
| 1138 | Graph* g = new Graph(OpRegistry::Global()); |
| 1139 | TF_CHECK_OK(root.ToGraph(g)); |
| 1140 | string device = use_gpu ? "gpu" : "cpu"; |
| 1141 | testing::UseRealTime(); |
| 1142 | test::Benchmark(device, g).Run(iters); |
| 1143 | |
| 1144 | testing::ItemsProcessed(batch_size * rows * cols * depth * iters); |
| 1145 | testing::SetLabel(label); |
| 1146 | } |
| 1147 | |
| 1148 | // BS: batch_size |
| 1149 | // IR: input_rows |
nothing calls this directly
no test coverage detected