Utility class for representing a list of immutable input tensors that are passed to the op as a single named argument.
| 470 | // Utility class for representing a list of immutable input tensors |
| 471 | // that are passed to the op as a single named argument. |
| 472 | class OpInputList { |
| 473 | public: |
| 474 | typedef OpArgIterator<OpInputList, const Tensor> Iterator; |
| 475 | OpInputList() : ctx_(nullptr), start_(0), stop_(0) {} |
| 476 | OpInputList(OpKernelContext* ctx, int start, int stop) |
| 477 | : ctx_(ctx), start_(start), stop_(stop) {} |
| 478 | OpInputList& operator=(const OpInputList& other) = default; |
| 479 | const Tensor& operator[](int i) const; |
| 480 | int size() const { return stop_ - start_; } |
| 481 | Iterator begin() const { return Iterator(this, 0); } |
| 482 | Iterator end() const { return Iterator(this, size()); } |
| 483 | |
| 484 | private: |
| 485 | OpKernelContext* ctx_; // not owned |
| 486 | int start_; |
| 487 | int stop_; |
| 488 | }; |
| 489 | |
| 490 | // Utility class for representing a list of mutable ("ref") input tensors |
| 491 | // that are passed to the op as a single named argument. |