Skip to content

Commit 483a423

Browse files
Factored out dpt.dtype and dpt.bool, etc. definitions into dedicated file
1 parent ea339eb commit 483a423

File tree

2 files changed

+67
-17
lines changed

2 files changed

+67
-17
lines changed

dpctl/tensor/__init__.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
2222
"""
2323

24-
from numpy import dtype
25-
2624
from dpctl.tensor._copy_utils import asnumpy, astype, copy, from_numpy, to_numpy
2725
from dpctl.tensor._ctors import (
2826
arange,
@@ -41,6 +39,23 @@
4139
zeros,
4240
zeros_like,
4341
)
42+
from dpctl.tensor._data_types import (
43+
bool,
44+
complex64,
45+
complex128,
46+
dtype,
47+
float16,
48+
float32,
49+
float64,
50+
int8,
51+
int16,
52+
int32,
53+
int64,
54+
uint8,
55+
uint16,
56+
uint32,
57+
uint64,
58+
)
4459
from dpctl.tensor._device import Device
4560
from dpctl.tensor._dlpack import from_dlpack
4661
from dpctl.tensor._manipulation_functions import (
@@ -68,21 +83,6 @@
6883
from dpctl.tensor._reshape import reshape
6984
from dpctl.tensor._usmarray import usm_ndarray
7085

71-
bool = dtype("bool")
72-
int8 = dtype("int8")
73-
int16 = dtype("int16")
74-
int32 = dtype("int32")
75-
int64 = dtype("int64")
76-
uint8 = dtype("uint8")
77-
uint16 = dtype("uint16")
78-
uint32 = dtype("uint32")
79-
uint64 = dtype("uint64")
80-
float16 = dtype("float16")
81-
float32 = dtype("float32")
82-
float64 = dtype("float64")
83-
complex64 = dtype("complex64")
84-
complex128 = dtype("complex128")
85-
8686
__all__ = [
8787
"Device",
8888
"usm_ndarray",

dpctl/tensor/_data_types.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Data Parallel Control (dpctl)
2+
#
3+
# Copyright 2020-2023 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
from numpy import dtype
18+
19+
bool = dtype("bool")
20+
int8 = dtype("int8")
21+
int16 = dtype("int16")
22+
int32 = dtype("int32")
23+
int64 = dtype("int64")
24+
uint8 = dtype("uint8")
25+
uint16 = dtype("uint16")
26+
uint32 = dtype("uint32")
27+
uint64 = dtype("uint64")
28+
float16 = dtype("float16")
29+
float32 = dtype("float32")
30+
float64 = dtype("float64")
31+
complex64 = dtype("complex64")
32+
complex128 = dtype("complex128")
33+
34+
__all__ = [
35+
"dtype",
36+
"bool",
37+
"int8",
38+
"uint8",
39+
"int16",
40+
"uint16",
41+
"int32",
42+
"uint32",
43+
"int64",
44+
"uint64",
45+
"float16",
46+
"float32",
47+
"float64",
48+
"complex64",
49+
"complex128",
50+
]

0 commit comments

Comments
 (0)