Skip to content

Import of deprecated dpnp.dparray class caused exception #1210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 63 additions & 3 deletions dpnp/dparray.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# cython: language_level=3
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2016-2020, Intel Corporation
# Copyright (c) 2016-2022, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -33,23 +33,77 @@ using USB interface for an Intel GPU device.

"""

import warnings

from libcpp cimport bool as cpp_bool

from dpnp.dpnp_iface_types import *
from dpnp.dpnp_iface import *
Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is importing of this module fixed by changes on lines 52-55 without removal of from dpnp.dpnp_iface import *?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it didn't help, the same exception raised.


# It's prohibeted to use 'import *' from 'dpnp.dpnp_iface_arraycreation' module here,
# because module has 'array' function, but cython has already imported 'array' by default.
# It would cause import collision. Thus instead import each function explicitly.
from dpnp.dpnp_iface_arraycreation import (
arange,
array,
asanyarray,
asarray,
ascontiguousarray,
copy,
diag,
diagflat,
empty,
empty_like,
eye,
frombuffer,
fromfile,
fromfunction,
fromiter,
fromstring,
full,
full_like,
geomspace,
identity,
linspace,
loadtxt,
logspace,
meshgrid,
mgrid,
ogrid,
ones,
ones_like,
ptp,
trace,
tri,
tril,
triu,
vander,
zeros,
zeros_like
)
from dpnp.dpnp_iface_bitwise import *
from dpnp.dpnp_iface_counting import *
from dpnp.dpnp_iface_indexing import *
from dpnp.dpnp_iface_libmath import *
from dpnp.dpnp_iface_linearalgebra import *
from dpnp.dpnp_iface_logic import *
from dpnp.dpnp_iface_manipulation import *
from dpnp.dpnp_iface_mathematical import *
from dpnp.dpnp_iface_searching import *
from dpnp.dpnp_iface_sorting import *
from dpnp.dpnp_iface_statistics import *
from dpnp.dpnp_iface_trigonometric import *

# to avoid interference with Python internal functions
from dpnp.dpnp_iface import sum as iface_sum
from dpnp.dpnp_iface import prod as iface_prod
from dpnp.dpnp_iface import get_dpnp_descriptor as iface_get_dpnp_descriptor

from dpnp.dpnp_algo cimport *
from dpnp.dpnp_iface_statistics import min, max # TODO do the same as for iface_sum
from dpnp.dpnp_iface_logic import all, any # TODO do the same as for iface_sum
import numpy
cimport numpy

from dpnp.dpnp_algo cimport *
cimport dpnp.dpnp_utils as utils


Expand Down Expand Up @@ -124,6 +178,12 @@ cdef class dparray:

"""

with warnings.catch_warnings():
warnings.filterwarnings("default", category=DeprecationWarning)
warnings.warn("dpnp.dparray class is deprecated, use dpnp.dpnp_array class instead",
DeprecationWarning,
stacklevel=2)

def __init__(self, shape, dtype=float64, memptr=None, strides=None, order=b'C'):
cdef Py_ssize_t shape_it = 0
cdef Py_ssize_t strides_it = 0
Expand Down