Skip to content

Commit

Permalink
Corrige rescale_up (#143)
Browse files Browse the repository at this point in the history
* Corrige rescale_up

* Apaga print de debug
  • Loading branch information
Lucas lopes authored Jun 25, 2021
1 parent 6132f19 commit 32af2ae
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cereja/utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,15 +671,15 @@ def _rescale_up(values, k, fill_with=None):
size = len(values)
assert size <= k, f'Error while resizing: {size} < {k}'
clones = (math.ceil(abs(size - k) / size))
for i in values:
vals = (i,) + ((fill_with,) if fill_with is not None else (i,)) * clones
for val in vals:

k -= 1
if k < 0:
break
yield val

refill_values = abs(k-size*clones)
for value in values:
yield value
if refill_values > 0:
refill_values -= 1
yield fill_with if fill_with is not None else value
k -= 1
if k < 0:
break

def rescale_values(values: List[Any], granularity: int, **kwargs) -> List[Any]:
"""
Expand Down

0 comments on commit 32af2ae

Please sign in to comment.