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::prelude::*;
@ -27,8 +28,8 @@ impl PyTensor {
}
#[getter]
fn shape(&self) -> Vec<usize> {
self.0.dims().to_vec()
fn shape(&self, py: Python<'_>) -> PyObject {
PyTuple::new(py, self.0.dims()).to_object(py)
}
#[getter]