Skip to content

Commit

Permalink
[Bugfix] np.str, np.bool are deprecated in higher version of numpy (#488
Browse files Browse the repository at this point in the history
)

* np.str, np.bool are deprecated in higher version of numpy

* fix duplicated key variable str
  • Loading branch information
eric-gecheng authored Oct 9, 2024
1 parent f403b69 commit 488b3ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions easy_rec/python/core/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def _get_np_type(field_type):
type_map = {
DatasetConfig.INT32: np.int32,
DatasetConfig.INT64: np.int64,
DatasetConfig.STRING: np.str,
DatasetConfig.BOOL: np.bool,
DatasetConfig.STRING: str,
DatasetConfig.BOOL: bool,
DatasetConfig.FLOAT: np.float32,
DatasetConfig.DOUBLE: np.double
}
Expand Down Expand Up @@ -329,7 +329,7 @@ def __init__(self,
for col_id in range(len(self._attr_np_types)):
np_type = self._attr_np_types[col_id]
print('\tcol_id[%d], dtype=%s' % (col_id, self._attr_gl_types[col_id]))
if np_type != np.str:
if np_type != str:
self._cols[col_id] = np.array(self._cols[col_id], dtype=np_type)
else:
self._cols[col_id] = np.asarray(
Expand Down Expand Up @@ -417,7 +417,7 @@ def _get_impl(self, ids):
for col_id in range(len(self._cols)):
tmp_col = self._cols[col_id]
np_type = self._attr_np_types[col_id]
if np_type != np.str:
if np_type != str:
sel_feas = tmp_col[sel_ids]
features.append(sel_feas)
else:
Expand Down
2 changes: 1 addition & 1 deletion easy_rec/python/utils/config_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def _get_basic_types():
bool, int, str, float,
type(u''), np.float16, np.float32, np.float64, np.char, np.byte, np.uint8,
np.int8, np.int16, np.uint16, np.uint32, np.int32, np.uint64, np.int64,
np.bool, np.str
bool, str
]
if six.PY2:
dtypes.append(long) # noqa: F821
Expand Down
1 change: 0 additions & 1 deletion easy_rec/python/utils/input_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def np_to_tf_type(np_type):
int: tf.int32,
np.int32: tf.int32,
np.int64: tf.int64,
np.str: tf.string,
str: tf.string,
np.float: tf.float32,
np.float32: tf.float32,
Expand Down

0 comments on commit 488b3ab

Please sign in to comment.