Skip to content

Commit

Permalink
Remove dtype in favor of DataType
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
league committed Jul 21, 2023
1 parent ef644d3 commit 8cdc0c7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 184 deletions.
2 changes: 1 addition & 1 deletion python/bifrost/DataType.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self, t: Optional[Union[str,_th.BFdtype_enum,_bf.BFdtype,"DataType"
self._veclen = 1 # TODO: Consider supporting this as part of string
elif isinstance(t, (_th.BFdtype_enum, _bf.BFdtype)): # Note: This is actually just a c_int
t = _th.BFdtype_enum(t).value
self._nbit = t & BF_DTYPE_NBIT_BITS
self._nbit = t & _bf.BF_DTYPE_NBIT_BITS
is_complex = bool(t & _bf.BF_DTYPE_COMPLEX_BIT)
self._kind = KINDMAP[t & _bf.BF_DTYPE_TYPE_BITS]
if is_complex:
Expand Down
180 changes: 0 additions & 180 deletions python/bifrost/dtype.py

This file was deleted.

5 changes: 2 additions & 3 deletions python/bifrost/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@
import ctypes
import numpy as np
from bifrost.memory import raw_malloc, raw_free, raw_get_space, space_accessible
from bifrost.libbifrost import _bf, _check, _space2string
from bifrost.libbifrost import _bf, _th, _check, _space2string
from bifrost import device
from bifrost.dtype import bifrost2string
from bifrost.DataType import DataType
from bifrost.Space import Space
from bifrost.libbifrost_generated import struct_BFarray_
Expand Down Expand Up @@ -171,7 +170,7 @@ def __new__(cls, base=None, space=None, shape=None, dtype=None,
shape = list(base.shape)[:ndim]
strides = list(base.strides)[:ndim]
space = _space2string(base.space)
dtype = bifrost2string(base.dtype)
dtype = _th.BFdtype_enum(base.dtype)

return ndarray.__new__(cls,
space=space,
Expand Down

0 comments on commit 8cdc0c7

Please sign in to comment.