Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
SunDoge committed Aug 21, 2023
1 parent 0532b8a commit fe412e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ impl ToTensor for PyRgbImage {
0
}

fn shape(&self) -> CowIntArray {
CowIntArray::from_owned(
[self.0.height(), self.0.width(), 3]
.map(|x| x as i64)
.to_vec(),
)
}

fn device(&self) -> Device {
Device::CPU
Expand All @@ -53,8 +46,10 @@ impl ToTensor for PyRgbImage {
DataType::U8
}

fn strides(&self) -> Option<CowIntArray> {
None
fn shape_and_strides(&self) -> ShapeAndStrides {
ShapeAndStrides::new_contiguous_with_strides(
&[self.0.height(), self.0.width(), 3].map(|x| x as i64),
)
}
}
```
Expand Down
2 changes: 0 additions & 2 deletions src/manager_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ where
}
}

impl<T> ManagerCtx<T> where T: ToTensor {}

impl<T> From<T> for ManagerCtx<T>
where
T: ToTensor,
Expand Down
4 changes: 2 additions & 2 deletions src/shape_and_strides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl ShapeAndStrides {
}
}

pub fn shape_ptr(&self) -> *mut i64 {
pub(crate) fn shape_ptr(&self) -> *mut i64 {
match self {
Self::Contiguous(ref v) => v.as_ptr() as *mut i64,
Self::WithStrides(ref v) => v.as_ptr() as *mut i64,
Expand All @@ -113,7 +113,7 @@ impl ShapeAndStrides {
}

/// Return nullptr if strides is None.
pub fn strides_ptr(&self) -> *mut i64 {
pub(crate) fn strides_ptr(&self) -> *mut i64 {
match self {
Self::Contiguous(_) => std::ptr::null_mut(),
Self::WithStrides(ref v) => &v[self.len()] as *const i64 as *mut i64,
Expand Down

0 comments on commit fe412e9

Please sign in to comment.