mirror of
https://github.com/huggingface/candle.git
synced 2025-06-19 11:56:45 +00:00
Get shape to return a tuple.
This commit is contained in:
@ -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]
|
||||||
|
Reference in New Issue
Block a user