Updating error handling in normalize_tuple (#15822)
On line 83 we test to see if single_value is an int (or able to be cast to an int). ValueError is fired if `int()` is called with an input like 'asdf' - this is caught and gives a helpful error, using the 'name' param to provide more context. However, when given an other than a string or int, this is *not* caught - making error messages much more esoteric than the helpful one written out here. For example, before, I was getting an error: > line 83, in normalize_tuple > int(single_value) > TypeError: int() argument must be a string or a number, not 'tuple' Now I get the more useful: > ValueError: The `kernel_size` argument must be a tuple of 2 integers. > Received: ((0, 3), 50) including element (0, 3) of type <type 'tuple'>
Loading
Please sign in to comment