Skip to content

Commit eb6324c

Browse files
authored
Remove numpy data type (#571)
* Change numpy data type; change test requirements. * Lint
1 parent a4e3168 commit eb6324c

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

maro/cli/data_pipeline/citi_bike.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from enum import Enum
99

1010
import geopy.distance
11-
import numpy as np
1211
import pandas as pd
1312
from yaml import safe_load
1413

@@ -320,7 +319,7 @@ def _process_distance(self, station_info: pd.DataFrame):
320319
0,
321320
index=station_info["station_index"],
322321
columns=station_info["station_index"],
323-
dtype=np.float,
322+
dtype=float,
324323
)
325324
look_up_df = station_info[["latitude", "longitude"]]
326325
return distance_adj.apply(
@@ -617,7 +616,7 @@ def _gen_distance(self, station_init: pd.DataFrame):
617616
0,
618617
index=station_init["station_index"],
619618
columns=station_init["station_index"],
620-
dtype=np.float,
619+
dtype=float,
621620
)
622621
look_up_df = station_init[["latitude", "longitude"]]
623622
distance_df = distance_adj.apply(

maro/rl/training/replay_memory.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def __init__(
204204
self._states = np.zeros((self._capacity, self._state_dim), dtype=np.float32)
205205
self._actions = np.zeros((self._capacity, self._action_dim), dtype=np.float32)
206206
self._rewards = np.zeros(self._capacity, dtype=np.float32)
207-
self._terminals = np.zeros(self._capacity, dtype=np.bool)
207+
self._terminals = np.zeros(self._capacity, dtype=bool)
208208
self._next_states = np.zeros((self._capacity, self._state_dim), dtype=np.float32)
209209
self._returns = np.zeros(self._capacity, dtype=np.float32)
210210
self._advantages = np.zeros(self._capacity, dtype=np.float32)
@@ -373,7 +373,7 @@ def __init__(
373373
self._actions = [np.zeros((self._capacity, action_dim), dtype=np.float32) for action_dim in self._action_dims]
374374
self._rewards = [np.zeros(self._capacity, dtype=np.float32) for _ in range(self.agent_num)]
375375
self._next_states = np.zeros((self._capacity, self._state_dim), dtype=np.float32)
376-
self._terminals = np.zeros(self._capacity, dtype=np.bool)
376+
self._terminals = np.zeros(self._capacity, dtype=bool)
377377

378378
assert len(agent_states_dims) == self.agent_num
379379
self._agent_states_dims = agent_states_dims

maro/streamit/client/metric.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def is_float_type(v_type: type):
6161
Returns:
6262
bool: True if an float type.
6363
"""
64-
return v_type is float or v_type is np.float or v_type is np.float32 or v_type is np.float64
64+
return v_type is float or v_type is np.float16 or v_type is np.float32 or v_type is np.float64
6565

6666

6767
def parse_value(value: object):

tests/requirements.test.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ deepdiff>=5.7.0
66
geopy>=2.0.0
77
holidays>=0.10.3
88
kubernetes>=21.7.0
9-
numpy>=1.19.5,<1.24.0
9+
numpy>=1.19.5
1010
pandas>=0.25.3
1111
paramiko>=2.9.2
1212
pytest>=7.1.2

tests/test_frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def test_append_nodes(self):
311311
self.assertListEqual([0.0, 0.0, 0.0, 0.0, 9.0], list(states)[0:5])
312312

313313
# 2 padding (NAN) in the end
314-
self.assertTrue((states[-2:].astype(np.int) == 0).all())
314+
self.assertTrue((states[-2:].astype(int) == 0).all())
315315

316316
states = static_snapshot[1::"a3"]
317317

0 commit comments

Comments
 (0)