`*_pool*d`: improve error handling and error messages. (#9648)
This PR refactors `{avg,max}_pool{2,3}d` operation implementations by
improving their error message, and returning a status type value.
**Key Changes:**
- Make `tensor_methods::avg_pool_nd{,_backward}` return
`StatusOr<XLATensorPtr>`
- Make `tensor_methods::max_pool_nd{,_backward}` return
`StatusOr<std::tuple<XLATensorPtr, XLATensorPtr>>`
- Improve error messages and error handling
- Remove `CheckIntList`
- Create the following new functions:
- `RepeatIfSingleElement(span, n)`: if `span` is a single-element list,
create a new one repeating it `n` times. Otherwise return the elements
in `span`.
- ` CheckPoolNdInputHasSize(...)`: check that the given list has a
specific size
- ` FillAndCheckPoolNdInputs(...)`: runs the 2 functions above for
`*_pool*d` common inputs, i.e. `kernel_size`, `stride`, and `padding`