diff --git a/easy_rec/python/core/sampler.py b/easy_rec/python/core/sampler.py index 779b30b48..a3f8bf7fd 100644 --- a/easy_rec/python/core/sampler.py +++ b/easy_rec/python/core/sampler.py @@ -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 } @@ -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( @@ -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: diff --git a/easy_rec/python/utils/config_util.py b/easy_rec/python/utils/config_util.py index 526b9a0fb..54c17dfda 100644 --- a/easy_rec/python/utils/config_util.py +++ b/easy_rec/python/utils/config_util.py @@ -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 diff --git a/easy_rec/python/utils/input_utils.py b/easy_rec/python/utils/input_utils.py index 183c7caad..cd8a5b975 100644 --- a/easy_rec/python/utils/input_utils.py +++ b/easy_rec/python/utils/input_utils.py @@ -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,