Get shape to return a tuple.

This commit is contained in:
laurent
2023-07-01 21:34:38 +01:00
parent fbbde5b02c
commit 86df4ad79c

View File

@ -1,3 +1,4 @@
use pyo3::types::PyTuple;
use pyo3::exceptions::{PyTypeError, PyValueError}; use pyo3::exceptions::{PyTypeError, PyValueError};
use pyo3::prelude::*; use pyo3::prelude::*;
@ -27,8 +28,8 @@ impl PyTensor {
} }
#[getter] #[getter]
fn shape(&self) -> Vec<usize> { fn shape(&self, py: Python<'_>) -> PyObject {
self.0.dims().to_vec() PyTuple::new(py, self.0.dims()).to_object(py)
} }
#[getter] #[getter]