Function numpy::inner

source · []
pub fn inner<'py, T, DIN1, DIN2, DOUT>(
    array1: &'py PyArray<T, DIN1>,
    array2: &'py PyArray<T, DIN2>
) -> PyResult<&'py PyArray<T, DOUT>> where
    DIN1: Dimension,
    DIN2: Dimension,
    DOUT: Dimension,
    T: Element
Expand description

Return the inner product of two arrays.

Example

pyo3::Python::with_gil(|py| {
    let array = numpy::pyarray![py, 1, 2, 3];
    let inner: &numpy::PyArray0::<_> = numpy::inner(array, array).unwrap();
    assert_eq!(inner.item(), 14);
});