Skip to content

Commit

Permalink
Changed np.bool to np.bool_ as those have been depreciated.
Browse files Browse the repository at this point in the history
  • Loading branch information
harshcurious committed Jun 22, 2023
1 parent f3bf1c2 commit b1ccd0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mltype/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def text2features(text, vocabulary):

ch2ix = {ch: ix for ix, ch in enumerate(vocabulary)}

output = np.zeros((text_size, vocab_size), dtype=np.bool)
output = np.zeros((text_size, vocab_size), dtype=np.bool_)
for i, ch in enumerate(text):
try:
output[i, ch2ix[ch]] = True
Expand Down Expand Up @@ -195,7 +195,7 @@ def sample_char(
if previous_chars:
features = text2features(previous_chars, vocabulary)
else:
features = np.zeros((1, len(vocabulary)), dtype=np.bool)
features = np.zeros((1, len(vocabulary)), dtype=np.bool_)

network.eval()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_basic(self):
vocabulary = ["a", "b", "c"]

res_true = np.array(
[[1, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 0]], dtype=np.bool
[[1, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 0]], dtype=np.bool_
)
res = text2features(text, vocabulary)

Expand Down

0 comments on commit b1ccd0c

Please sign in to comment.