Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename kornia-core to kornia-tensor #195

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
[workspace]
resolver = "2"
members = [
"crates/kornia-core",
"crates/kornia-core-ops",
"crates/kornia-image",
"crates/kornia-io",
"crates/kornia-imgproc",
"crates/kornia",
"crates/*",
"examples/*",
"crates/kornia-icp",
# "kornia-py",
"kornia-viz",
"crates/kornia-3d",
]
exclude = ["kornia-py", "kornia-serve"]

@@ -31,8 +24,8 @@ version = "0.1.8-rc.1"

[workspace.dependencies]
# NOTE: remember to update the kornia-py package version in `kornia-py/Cargo.toml` when updating the Rust package version
kornia-core = { path = "crates/kornia-core", version = "0.1.8-rc.1" }
kornia-core-ops = { path = "crates/kornia-core-ops", version = "0.1.8-rc.1" }
kornia-tensor = { path = "crates/kornia-tensor", version = "0.1.8-rc.1" }
kornia-tensor-ops = { path = "crates/kornia-tensor-ops", version = "0.1.8-rc.1" }
kornia-icp = { path = "crates/kornia-icp", version = "0.1.8-rc.1" }
kornia-image = { path = "crates/kornia-image", version = "0.1.8-rc.1" }
kornia-io = { path = "crates/kornia-io", version = "0.1.8-rc.1" }
2 changes: 1 addition & 1 deletion crates/kornia-3d/benches/bench_linalg.rs
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ fn bench_transform_points3d(c: &mut Criterion) {
|b, i| {
let (src, rot, trans, mut dst) = (i.0, i.1, i.2, i.3.clone());
b.iter(|| {
linalg::transform_points3d(src, rot, trans, &mut dst);
linalg::transform_points3d(src, rot, trans, &mut dst).unwrap();
black_box(());
});
},
1 change: 0 additions & 1 deletion crates/kornia-icp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ version.workspace = true
[dependencies]
faer = { workspace = true }
kiddo = "5.0.2"
kornia-core = { workspace = true }
kornia-3d = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true }
2 changes: 1 addition & 1 deletion crates/kornia-image/Cargo.toml
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@ rust-version.workspace = true
version.workspace = true

[dependencies]
kornia-core = { workspace = true }
kornia-tensor = { workspace = true }
num-traits = { workspace = true }
thiserror = { workspace = true }
2 changes: 1 addition & 1 deletion crates/kornia-image/src/error.rs
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ pub enum ImageError {

/// Error when the image shape is not valid.
#[error("Invalid image shape")]
InvalidImageShape(#[from] kornia_core::TensorError),
InvalidImageShape(#[from] kornia_tensor::TensorError),

/// Error when the image size is not valid.
#[error("Invalid image size ({0}, {1}) mismatch ({2}, {3})")]
4 changes: 2 additions & 2 deletions crates/kornia-image/src/image.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use kornia_core::{CpuAllocator, Tensor, Tensor2, Tensor3};
use kornia_tensor::{CpuAllocator, Tensor, Tensor2, Tensor3};

use crate::error::ImageError;

@@ -471,7 +471,7 @@ impl<T, const C: usize> TryInto<Tensor3<T, CpuAllocator>> for Image<T, C> {
#[cfg(test)]
mod tests {
use crate::image::{Image, ImageError, ImageSize};
use kornia_core::{CpuAllocator, Tensor};
use kornia_tensor::{CpuAllocator, Tensor};

#[test]
fn image_size() {
2 changes: 1 addition & 1 deletion crates/kornia-imgproc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ version.workspace = true

[dependencies]
fast_image_resize = "5.1.0"
kornia-core = { workspace = true }
kornia-tensor = { workspace = true }
kornia-image = { workspace = true }
num-traits = { workspace = true }
rayon = "1.10"
2 changes: 1 addition & 1 deletion crates/kornia-imgproc/src/calibration/distortion.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::{CameraExtrinsic, CameraIntrinsic};
use crate::interpolation::grid::meshgrid_from_fn;
use kornia_core::{CpuTensor2, TensorError};
use kornia_image::ImageSize;
use kornia_tensor::{CpuTensor2, TensorError};

/// Represents the polynomial distortion parameters of a camera using the Brown-Conrady model.
///
2 changes: 1 addition & 1 deletion crates/kornia-imgproc/src/interpolation/grid.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use kornia_core::{CpuAllocator, CpuTensor2, TensorError};
use kornia_tensor::{CpuAllocator, CpuTensor2, TensorError};
use num_traits::Float;
use rayon::iter::ParallelIterator;
use rayon::{iter::IndexedParallelIterator, slice::ParallelSliceMut};
4 changes: 2 additions & 2 deletions crates/kornia-imgproc/src/interpolation/remap.rs
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@ use crate::parallel;

use super::interpolate::interpolate_pixel;
use super::InterpolationMode;
use kornia_core::{CpuAllocator, Tensor2};
use kornia_image::{Image, ImageError};
use kornia_tensor::{CpuAllocator, Tensor2};

/// Apply generic geometric transformation to an image.
///
@@ -57,8 +57,8 @@ pub fn remap<const C: usize>(

#[cfg(test)]
mod tests {
use kornia_core::{CpuAllocator, Tensor2};
use kornia_image::{Image, ImageError, ImageSize};
use kornia_tensor::{CpuAllocator, Tensor2};

#[test]
fn remap_smoke() -> Result<(), ImageError> {
2 changes: 1 addition & 1 deletion crates/kornia-imgproc/src/parallel.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rayon::prelude::*;

use kornia_core::{CpuAllocator, Tensor2};
use kornia_image::Image;
use kornia_tensor::{CpuAllocator, Tensor2};

/// Apply a function to each pixel in the image in parallel.
///
2 changes: 1 addition & 1 deletion crates/kornia-imgproc/src/resize.rs
Original file line number Diff line number Diff line change
@@ -195,8 +195,8 @@ pub fn resize_fast(

#[cfg(test)]
mod tests {
use kornia_core::TensorError;
use kornia_image::{Image, ImageError, ImageSize};
use kornia_tensor::TensorError;

#[test]
fn resize_smoke_ch3() -> Result<(), ImageError> {
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "kornia-core-ops"
name = "kornia-tensor-ops"
authors.workspace = true
description = "Tensor operations library in Rust for computer vision"
edition.workspace = true
@@ -11,6 +11,6 @@ rust-version.workspace = true
version.workspace = true

[dependencies]
kornia-core = { workspace = true }
kornia-tensor = { workspace = true }
num-traits = { workspace = true }
thiserror = { workspace = true }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use kornia_core::TensorError;
use kornia_tensor::TensorError;
use thiserror::Error;

/// An error type for tensor operations.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use kornia_core::{storage::TensorStorage, Tensor, TensorAllocator};
use kornia_tensor::{storage::TensorStorage, Tensor, TensorAllocator};
use num_traits::Zero;

use crate::error::TensorOpsError;
@@ -21,8 +21,8 @@ use crate::error::TensorOpsError;
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_core_ops::ops::sum_elements;
/// use kornia_tensor::{Tensor, CpuAllocator};
/// use kornia_tensor_ops::ops::sum_elements;
///
/// let data: [u8; 6] = [1, 1, 1, 1, 1, 1];
/// let t = Tensor::<u8, 2, CpuAllocator>::from_shape_slice([2, 3], &data, CpuAllocator).unwrap();
@@ -78,7 +78,7 @@ where

#[cfg(test)]
mod tests {
use kornia_core::{CpuAllocator, TensorError};
use kornia_tensor::{CpuAllocator, TensorError};

use super::*;

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "kornia-core"
name = "kornia-tensor"
authors.workspace = true
description = "Lightweight tensor library in Rust for computer vision"
edition.workspace = true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ pub(crate) fn get_strides_from_shape<const N: usize>(shape: [usize; N]) -> [usiz
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data: Vec<u8> = vec![1, 2, 3, 4];
/// let t = Tensor::<u8, 2, CpuAllocator>::from_shape_vec([2, 2], data, CpuAllocator).unwrap();
@@ -156,7 +156,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data: Vec<u8> = vec![1, 2, 3, 4];
/// let t = Tensor::<u8, 2, CpuAllocator>::from_shape_vec([2, 2], data, CpuAllocator).unwrap();
@@ -222,7 +222,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let t = Tensor::<u8, 1, CpuAllocator>::from_shape_val([4], 0, CpuAllocator);
/// assert_eq!(t.as_slice(), vec![0, 0, 0, 0]);
@@ -264,7 +264,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let t = Tensor::<u8, 1, CpuAllocator>::from_shape_fn([4], CpuAllocator, |[i]| i as u8);
/// assert_eq!(t.as_slice(), vec![0, 1, 2, 3]);
@@ -399,7 +399,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data: Vec<u8> = vec![1, 2, 3, 4];
///
@@ -431,7 +431,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data: Vec<u8> = vec![1, 2, 3, 4];
///
@@ -466,7 +466,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data: Vec<u8> = vec![1, 2, 3, 4];
///
@@ -569,7 +569,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data: Vec<u8> = vec![1, 2, 3, 4];
/// let t = Tensor::<u8, 1, CpuAllocator>::from_shape_vec([4], data, CpuAllocator).unwrap();
@@ -643,7 +643,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data: Vec<u8> = vec![1, 2, 3, 4];
/// let t = Tensor::<u8, 1, CpuAllocator>::from_shape_vec([4], data, CpuAllocator).unwrap();
@@ -682,7 +682,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data1: Vec<u8> = vec![1, 2, 3, 4];
/// let t1 = Tensor::<u8, 1, CpuAllocator>::from_shape_vec([4], data1, CpuAllocator).unwrap();
@@ -746,7 +746,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data1: Vec<u8> = vec![1, 2, 3, 4];
/// let t1 = Tensor::<u8, 1, CpuAllocator>::from_shape_vec([4], data1, CpuAllocator).unwrap();
@@ -778,7 +778,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data1: Vec<u8> = vec![1, 2, 3, 4];
/// let t1 = Tensor::<u8, 1, CpuAllocator>::from_shape_vec([4], data1, CpuAllocator).unwrap();
@@ -810,7 +810,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data1: Vec<u8> = vec![1, 2, 3, 4];
/// let t1 = Tensor::<u8, 1, CpuAllocator>::from_shape_vec([4], data1, CpuAllocator).unwrap();
@@ -842,7 +842,7 @@ where
/// # Example
///
/// ```
/// use kornia_core::{Tensor, CpuAllocator};
/// use kornia_tensor::{Tensor, CpuAllocator};
///
/// let data1: Vec<u8> = vec![1, 2, 3, 4];
/// let t1 = Tensor::<u8, 1, CpuAllocator>::from_shape_vec([4], data1, CpuAllocator).unwrap();
File renamed without changes.
4 changes: 2 additions & 2 deletions crates/kornia/Cargo.toml
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@ gstreamer = ["kornia-io/gstreamer"]
jpegturbo = ["kornia-io/jpegturbo"]

[dependencies]
kornia-core.workspace = true
kornia-core-ops.workspace = true
kornia-tensor.workspace = true
kornia-tensor-ops.workspace = true
kornia-image.workspace = true
kornia-imgproc.workspace = true
kornia-io = { workspace = true, features = [] }
4 changes: 2 additions & 2 deletions crates/kornia/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[doc(inline)]
pub use kornia_core as core;
pub use kornia_tensor as core;

#[doc(inline)]
pub use kornia_core_ops as core_ops;
pub use kornia_tensor_ops as core_ops;

#[doc(inline)]
pub use kornia_image as image;
5 changes: 3 additions & 2 deletions scripts/release_rust.sh
Original file line number Diff line number Diff line change
@@ -9,9 +9,10 @@ if [[ "$1" == "--no-dry-run" ]]; then
fi

# Publish crates
cross publish -p kornia-core $DRY_RUN
cross publish -p kornia-core-ops $DRY_RUN
cross publish -p kornia-tensor $DRY_RUN
cross publish -p kornia-tensor-ops $DRY_RUN
cross publish -p kornia-image $DRY_RUN
cross publish -p kornia-icp $DRY_RUN
cross publish -p kornia-io --all-features $DRY_RUN
cross publish -p kornia-imgproc $DRY_RUN
cross publish -p kornia --all-features $DRY_RUN