Add defensive tuple() in lax.reduce_window (#3741)

This commit is contained in:
James Bradbury 2020-07-13 14:37:46 -07:00 committed by GitHub
parent 3c6cd5fb94
commit 6017205cea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1123,6 +1123,8 @@ def reduce_window(operand: Array, init_value: Array, computation: Callable,
if isinstance(padding, str):
padding = padtype_to_pads(operand.shape, window_dimensions,
window_strides, padding)
else:
padding = tuple(padding)
monoid_reducer = _get_monoid_window_reducer(computation, init_value)
if monoid_reducer:
return monoid_reducer(operand, window_dimensions, window_strides, padding)