tensorflow/core/grappler/optimizers/inference/batch_op_rewriter_test.cc
// Tests that invalid argument are caught.
Tests that invalid argument are caught.
Tests that invalid argument are caught .
TEST_P(BatchOpRewriterTest, InvalidArgumentForAdaptiveBatchScheduler) {
  GrapplerItem item;
  AddBatchOp(&item.graph, 16);
  BatchOpRewriteConfig config;
  config.set_enable_adaptive_shared_batching_thread_pool(GetParam());
  (*config.mutable_model_scheduler_options())["model_with_override"]
      .mutable_batches_to_average_over()
      ->set_value(1000);
  (*config.mutable_model_scheduler_options())["model_with_override"]
      .mutable_initial_inflight_batches_limit()
      ->set_value(8);
  (*config.mutable_model_scheduler_options())["model_with_override"]
      .mutable_min_inflight_batches_limit()
      ->set_value(16);
  (*config.mutable_model_scheduler_options())["model_with_override"]
      .mutable_max_inflight_batches_limit()
      ->set_value(32);
  RewriterConfig_CustomGraphOptimizer rewriter_config = MakeConfig(config);
  BatchOpRewriter optimizer;
  TF_ASSERT_OK(optimizer.Init(&rewriter_config));
  optimizer.config_proto_.mutable_experimental()
      ->mutable_session_metadata()
      ->set_version(123);
  optimizer.config_proto_.mutable_experimental()
      ->mutable_session_metadata()
      ->set_name("model_with_override");
  GraphDef optimized_graph;
  Status status = optimizer.Optimize(nullptr, item, &optimized_graph);
  EXPECT_FALSE(status.ok());
  EXPECT_TRUE(errors::IsInvalidArgument(status));
}
TEST_P ( BatchOpRewriterTest , InvalidArgumentForAdaptiveBatchScheduler ) { GrapplerItem item ; AddBatchOp ( & item . graph , 16 ) ; BatchOpRewriteConfig config ; config . set_enable_adaptive_shared_batching_thread_pool ( GetParam ( ) ) ; ( * config . mutable_model_scheduler_options ( ) ) [ " " ] . mutable_batches_to_average_over ( ) -> set_value ( 1000 ) ; ( * config . mutable_model_scheduler_options ( ) ) [ " " ] . mutable_initial_inflight_batches_limit ( ) -> set_value ( 8 ) ; ( * config . mutable_model_scheduler_options ( ) ) [ " " ] . mutable_min_inflight_batches_limit ( ) -> set_value ( 16 ) ; ( * config . mutable_model_scheduler_options ( ) ) [ " " ] . mutable_max_inflight_batches_limit ( ) -> set_value ( 32 ) ; RewriterConfig_CustomGraphOptimizer rewriter_config = MakeConfig ( config ) ; BatchOpRewriter optimizer ; TF_ASSERT_OK ( optimizer . Init ( & rewriter_config ) ) ; optimizer . config_proto_ . mutable_experimental ( ) -> mutable_session_metadata ( ) -> set_version ( 123 ) ; optimizer . config_proto_ . mutable_experimental ( ) -> mutable_session_metadata ( ) -> set_name ( " " ) ; GraphDef optimized_graph ; Status status = optimizer . Optimize ( nullptr , item , & optimized_graph ) ; EXPECT_FALSE ( status . ok ( ) ) ; EXPECT_TRUE ( errors :: IsInvalidArgument ( status ) ) ; }
Tests that invalid argument are caught.
Tests that invalid argument are caught .
// PARSE_TEXT_PROTO isn't available in TF OSS.