| 92 | } |
| 93 | |
| 94 | void KernelContext::AssignOutputRange(std::pair<int, int>&& range, size_t idx) { |
| 95 | if (idx < output_range_.size()) { |
| 96 | output_range_[idx] = std::move(range); |
| 97 | } else if (idx == output_range_.size()) { |
| 98 | output_range_.emplace_back(range); |
| 99 | } else { |
| 100 | PADDLE_THROW(common::errors::PreconditionNotMet( |
| 101 | "Invalid idx when trying to set InputRange, " |
| 102 | "index is `%d`, it is greater than the size(%d) of InputRange.", |
| 103 | idx, |
| 104 | output_range_.size())); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | const std::pair<int, int>& KernelContext::InputRangeAt(size_t idx) const { |
| 109 | return input_range_.at(idx); |