}
impl View for &PyView<'_> {
- fn data(&self) -> std::borrow::Cow<[u8]> {
+ fn data(&self) -> std::borrow::Cow<'_, [u8]> {
Cow::Borrowed(self.data.as_bytes())
}
fn shape(&self) -> &[usize] {
/// fn shape(&self) -> &[usize]{
/// &self.shape
/// }
-/// fn data(&self) -> Cow<[u8]>{
+/// fn data(&self) -> Cow<'_, [u8]>{
/// (&self.data).into()
/// }
/// fn data_len(&self) -> usize{
/// fn shape(&self) -> &[usize]{
/// &self.shape
/// }
-/// fn data(&self) -> Cow<[u8]>{
+/// fn data(&self) -> Cow<'_, [u8]>{
/// self.data.into()
/// }
/// fn data_len(&self) -> usize{
/// fn shape(&self) -> &[usize]{
/// &self.shape
/// }
-/// fn data(&self) -> Cow<[u8]>{
+/// fn data(&self) -> Cow<'_, [u8]>{
/// // This copies data from GPU to CPU.
/// let data: Vec<u8> = self.data.to_vec();
/// data.into()
/// The shape of the tensor
fn shape(&self) -> &[usize];
/// The data of the tensor
- fn data(&self) -> Cow<[u8]>;
+ fn data(&self) -> Cow<'_, [u8]>;
/// The length of the data, in bytes.
/// This is necessary as this might be faster to get than `data().len()`
/// for instance for tensors residing in GPU.
&self.shape
}
- fn data(&self) -> Cow<[u8]> {
+ fn data(&self) -> Cow<'_, [u8]> {
self.data.into()
}
&self.shape
}
- fn data(&self) -> Cow<[u8]> {
+ fn data(&self) -> Cow<'_, [u8]> {
self.data.into()
}