Skip to content

Commit d477a55

Browse files
bschoenmaeckersdavidhewitt
authored andcommitted
Update sum_products
1 parent 9c5d52e commit d477a55

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub use crate::dtype::{
117117
pub use crate::error::{BorrowError, FromVecError, NotContiguousError};
118118
pub use crate::npyffi::{PY_ARRAY_API, PY_UFUNC_API};
119119
pub use crate::strings::{PyFixedString, PyFixedUnicode};
120-
#[allow(deprecated)]
120+
#[cfg(feature = "gil-refs")]
121121
pub use crate::sum_products::{dot, einsum, inner};
122122
pub use crate::sum_products::{dot_bound, einsum_bound, inner_bound};
123123
pub use crate::untyped_array::{PyUntypedArray, PyUntypedArrayMethods};

src/sum_products.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ use std::ptr::null_mut;
44

55
use ndarray::{Dimension, IxDyn};
66
use pyo3::types::PyAnyMethods;
7-
use pyo3::{Borrowed, Bound, FromPyObject, PyNativeType, PyResult};
7+
#[cfg(feature = "gil-refs")]
8+
use pyo3::PyNativeType;
9+
use pyo3::{Borrowed, Bound, FromPyObject, PyResult};
810

911
use crate::array::PyArray;
1012
use crate::dtype::Element;
@@ -13,6 +15,7 @@ use crate::npyffi::{array::PY_ARRAY_API, NPY_CASTING, NPY_ORDER};
1315
/// Return value of a function that can yield either an array or a scalar.
1416
pub trait ArrayOrScalar<'py, T>: FromPyObject<'py> {}
1517

18+
#[cfg(feature = "gil-refs")]
1619
impl<'py, T, D> ArrayOrScalar<'py, T> for &'py PyArray<T, D>
1720
where
1821
T: Element,
@@ -30,10 +33,7 @@ where
3033
impl<'py, T> ArrayOrScalar<'py, T> for T where T: Element + FromPyObject<'py> {}
3134

3235
/// Deprecated form of [`inner_bound`]
33-
#[deprecated(
34-
since = "0.21.0",
35-
note = "will be replaced by `inner_bound` in the future"
36-
)]
36+
#[cfg(feature = "gil-refs")]
3737
pub fn inner<'py, T, DIN1, DIN2, OUT>(
3838
array1: &'py PyArray<T, DIN1>,
3939
array2: &'py PyArray<T, DIN2>,
@@ -100,10 +100,7 @@ where
100100
}
101101

102102
/// Deprecated form of [`dot_bound`]
103-
#[deprecated(
104-
since = "0.21.0",
105-
note = "will be replaced by `dot_bound` in the future"
106-
)]
103+
#[cfg(feature = "gil-refs")]
107104
pub fn dot<'py, T, DIN1, DIN2, OUT>(
108105
array1: &'py PyArray<T, DIN1>,
109106
array2: &'py PyArray<T, DIN2>,
@@ -176,10 +173,7 @@ where
176173
}
177174

178175
/// Deprecated form of [`einsum_bound`]
179-
#[deprecated(
180-
since = "0.21.0",
181-
note = "will be replaced by `einsum_bound` in the future"
182-
)]
176+
#[cfg(feature = "gil-refs")]
183177
pub fn einsum<'py, T, OUT>(subscripts: &str, arrays: &[&'py PyArray<T, IxDyn>]) -> PyResult<OUT>
184178
where
185179
T: Element,
@@ -226,10 +220,7 @@ where
226220
}
227221

228222
/// Deprecated form of [`einsum_bound!`][crate::einsum_bound!]
229-
#[deprecated(
230-
since = "0.21.0",
231-
note = "will be replaced by `einsum_bound!` in the future"
232-
)]
223+
#[cfg(feature = "gil-refs")]
233224
#[macro_export]
234225
macro_rules! einsum {
235226
($subscripts:literal $(,$array:ident)+ $(,)*) => {{

0 commit comments

Comments
 (0)