Skip to content

Commit

Permalink
RF: make strides integers to avoid deprecation
Browse files Browse the repository at this point in the history
Non-integer strides give a VisibleDeprecationWarning for numpy 1.11.
  • Loading branch information
matthew-brett committed Jun 1, 2016
1 parent f3f4945 commit 0e1c249
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/inference_algs.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def match_shape(x,yshape,axes):
if isinstance(axes,int): axes = [axes]
assert len(x.shape) == len(axes)
assert all(xsize == yshape[yax] for xsize,yax in zip(x.shape,axes))
strides = np.zeros(len(yshape))
for yax,xstride in zip(axes,x.strides):
strides = np.zeros(len(yshape), dtype=np.intp)
for yax,xstride in zip(axes,x.strides):
strides[yax] = xstride
return np.ndarray.__new__(np.ndarray, strides=strides, shape=yshape, buffer=x, dtype=x.dtype)

Expand Down

0 comments on commit 0e1c249

Please sign in to comment.