Skip to content

Commit

Permalink
Fix np.pad() casting
Browse files Browse the repository at this point in the history
  • Loading branch information
arshajii committed Feb 11, 2025
1 parent b58b1ee commit f1ab711
Show file tree
Hide file tree
Showing 3 changed files with 399 additions and 5 deletions.
4 changes: 2 additions & 2 deletions stdlib/numpy/format.codon
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class FloatingFormat:
self.__init__()
return

min_val = None
max_val = None
min_val: Optional[a.dtype] = None
max_val: Optional[a.dtype] = None
finite = 0
abs_non_zero = 0
exp_format = False
Expand Down
4 changes: 2 additions & 2 deletions stdlib/numpy/routines.codon
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ def pad(array, pad_width, mode = 'constant', **kwargs):
if dtype is int or isinstance(dtype, Int) or isinstance(dtype, UInt):
return util.cast(util.rint(x), dtype)
else:
return x
return util.cast(x, dtype)

def pad_from_function(a: ndarray, pw, padding_func, kwargs, extra = None):
shape = a.shape
Expand Down Expand Up @@ -2915,7 +2915,7 @@ def pad(array, pad_width, mode = 'constant', **kwargs):
fill_linear(vector,
offset=(n - p2),
start=util.cast(end2, float),
stop=util.cast(start1, float),
stop=util.cast(start2, float),
num=p2,
rev=True)

Expand Down
Loading

0 comments on commit f1ab711

Please sign in to comment.