message: [tf.data] Propagate private threadpool size parameter during iterator creation so that it is (actually) used as the maximum degree of parallelism for autotuning.
diff: @@ -187,20 +187,15 @@ class ThreadPoolDatasetOp : public UnaryDatasetOpKernel {
  : DatasetIterator<Dataset>(params) {}
  Status Initialize(IteratorContext* ctx) override {
  - return dataset()->input_->MakeIterator(ctx, prefix(), &input_impl_);
  + return dataset()->input_->MakeIterator(
  + IteratorContext(CreateParams(ctx)), prefix(), &input_impl_);
  }
  Status GetNextInternal(IteratorContext* ctx,
  std::vector<Tensor>* out_tensors,
  bool* end_of_sequence) override {
  - ThreadPoolResource* pool = dataset()->threadpool_;
  - IteratorContext::Params params(ctx);
  - params.runner = [pool](std::function<void()> c) {
  - pool->Schedule(std::move(c));
  - };
  - params.runner_threadpool_size = pool->NumThreads();
  - IteratorContext iter_ctx(params);
  - return input_impl_->GetNext(&iter_ctx, out_tensors, end_of_sequence);
  + return input_impl_->GetNext(IteratorContext(CreateParams(ctx)),
  + out_tensors, end_of_sequence);
  }
  protected:
  @@ -211,6 +206,16 @@ class ThreadPoolDatasetOp : public UnaryDatasetOpKernel {
  }
  private:
  + IteratorContext::Params CreateParams(IteratorContext* ctx) {
  + ThreadPoolResource* pool = dataset()->threadpool_;
  + IteratorContext::Params params(ctx);
  + params.runner = [pool](std::function<void()> c) {
  + pool->Schedule(std::move(c));
  + };
  + params.runner_threadpool_size = pool->NumThreads();
  + return params;
  + }
  +
  std::unique_ptr<IteratorBase> input_impl_;
  };
  