def run_test(arr, *args, **kwargs): axis = kwargs.pop('axis', None) for fn1 in self.array_transforms: for fn2 in self.array_transforms: arr_arg = fn1(arr) axis_arg = fn2(axis) if axis is not None else None self.match( array_ops.amax(arr_arg, axis=axis_arg, *args, **kwargs), np.amax(arr_arg, axis=axis, *args, **kwargs)) self.match( array_ops.amin(arr_arg, axis=axis_arg, *args, **kwargs), np.amin(arr_arg, axis=axis, *args, **kwargs))
def ptp(a, axis=None, keepdims=None): return (array_ops.amax(a, axis=axis, keepdims=keepdims) - array_ops.amin(a, axis=axis, keepdims=keepdims))