Skip to content

Commit

Permalink
check for negative weights
Browse files Browse the repository at this point in the history
throw valueerror
  • Loading branch information
Patrick Quoika authored and Clownshift committed Oct 5, 2021
1 parent cb04da9 commit 4a7e25d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions package/xentropy/internal/pre_post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def process_weights_argument(weights, verbose=False):
if verbose:
print("Weights have been given.")
weights = np.array(weights)
if True in (weights < 0):
err_msg = "You gave negative values in you weights array.\n"
raise ValueError(err_msg)

return weights, weight_switch

Expand Down

0 comments on commit 4a7e25d

Please sign in to comment.