Commit 0086c55a authored by Luke Schaefer's avatar Luke Schaefer Committed by Rasmus Munk Larsen
Browse files

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'>
parent 4e685689
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment