Skip to content

Commit 8cdc0c7

Browse files
committed
Remove dtype in favor of DataType
This supersedes e6bed74 in apr2022-prune branch (PR #178). There was a new usage of dtype.bifrost2string in ndarray.py, which wasn't part of the apr2022-prune branch. I think (?) I worked around it correctly using the enum. We also discovered and fixed a NameError bug in DataType.
1 parent ef644d3 commit 8cdc0c7

File tree

3 files changed

+3
-184
lines changed

3 files changed

+3
-184
lines changed

python/bifrost/DataType.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __init__(self, t: Optional[Union[str,_th.BFdtype_enum,_bf.BFdtype,"DataType"
129129
self._veclen = 1 # TODO: Consider supporting this as part of string
130130
elif isinstance(t, (_th.BFdtype_enum, _bf.BFdtype)): # Note: This is actually just a c_int
131131
t = _th.BFdtype_enum(t).value
132-
self._nbit = t & BF_DTYPE_NBIT_BITS
132+
self._nbit = t & _bf.BF_DTYPE_NBIT_BITS
133133
is_complex = bool(t & _bf.BF_DTYPE_COMPLEX_BIT)
134134
self._kind = KINDMAP[t & _bf.BF_DTYPE_TYPE_BITS]
135135
if is_complex:

python/bifrost/dtype.py

Lines changed: 0 additions & 180 deletions
This file was deleted.

python/bifrost/ndarray.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@
4040
import ctypes
4141
import numpy as np
4242
from bifrost.memory import raw_malloc, raw_free, raw_get_space, space_accessible
43-
from bifrost.libbifrost import _bf, _check, _space2string
43+
from bifrost.libbifrost import _bf, _th, _check, _space2string
4444
from bifrost import device
45-
from bifrost.dtype import bifrost2string
4645
from bifrost.DataType import DataType
4746
from bifrost.Space import Space
4847
from bifrost.libbifrost_generated import struct_BFarray_
@@ -171,7 +170,7 @@ def __new__(cls, base=None, space=None, shape=None, dtype=None,
171170
shape = list(base.shape)[:ndim]
172171
strides = list(base.strides)[:ndim]
173172
space = _space2string(base.space)
174-
dtype = bifrost2string(base.dtype)
173+
dtype = _th.BFdtype_enum(base.dtype)
175174

176175
return ndarray.__new__(cls,
177176
space=space,

0 commit comments

Comments
 (0)