| 1339 | BM_Softplus(32, 14, 14, 576, 4, "softplus10"); |
| 1340 | |
| 1341 | static void BM_ImageNetSoftmaxFwd(int iters, int batch_size, int node_depth, |
| 1342 | int num_threads, bool use_gpu, |
| 1343 | const string& label) { |
| 1344 | auto root = Scope::NewRootScope().ExitOnError(); |
| 1345 | |
| 1346 | Tensor input(DT_FLOAT, TensorShape({batch_size, node_depth})); |
| 1347 | input.flat<float>().setRandom(); |
| 1348 | |
| 1349 | auto softmax = ops::Softmax(root, input); |
| 1350 | |
| 1351 | TF_CHECK_OK(root.status()); |
| 1352 | Graph* g = new Graph(OpRegistry::Global()); |
| 1353 | TF_CHECK_OK(root.ToGraph(g)); |
| 1354 | string device = use_gpu ? "gpu" : "cpu"; |
| 1355 | SessionOptions opts; |
| 1356 | opts.config.set_inter_op_parallelism_threads(1); |
| 1357 | opts.config.set_intra_op_parallelism_threads(num_threads); |
| 1358 | opts.config.set_use_per_session_threads(true); |
| 1359 | opts.config.mutable_graph_options() |
| 1360 | ->mutable_optimizer_options() |
| 1361 | ->set_opt_level(OptimizerOptions::L0); |
| 1362 | testing::UseRealTime(); |
| 1363 | test::Benchmark(device, g, &opts).Run(iters); |
| 1364 | testing::ItemsProcessed(batch_size * node_depth * iters); |
| 1365 | testing::SetLabel(label); |
| 1366 | } |
| 1367 | |
| 1368 | #define BM_ImageNetSoftmaxFwd(BATCH_SIZE, NODE_DEPTH, TH, GPU, LABEL) \ |
| 1369 | static void \ |
no test coverage detected