Struct DiceInput
pub struct DiceInput<B, const D: usize = 4>where
B: Backend,{ /* private fields */ }Expand description
Input type for the DiceMetric.
§Type Parameters
B: Backend type.D: Number of dimensions. Should be more than, or equal to 3 (default 4).
Implementations§
§impl<B, const D: usize> DiceInput<B, D>where
B: Backend,
impl<B, const D: usize> DiceInput<B, D>where
B: Backend,
pub fn new(
outputs: Tensor<B, D, Int>,
targets: Tensor<B, D, Int>,
) -> DiceInput<B, D>
pub fn new( outputs: Tensor<B, D, Int>, targets: Tensor<B, D, Int>, ) -> DiceInput<B, D>
Creates a new DiceInput with the given outputs and targets.
Inputs are expected to have the dimensions [B, C, ...]
where B is the batch size, C is the number of classes,
and ... represents additional dimensions (e.g., height, width for images).
If C is more than 1, the first class (index 0) is considered the background.
Additionally, one-hot encoding is the responsibility of the caller.
§Arguments
outputs: The model outputs as a tensor.targets: The ground truth targets as a tensor.
§Returns
A new instance of DiceInput.
§Panics
- If
Dis less than 3. - If
outputsandtargetsdo not have the same dimensions. - If
outputsortargetsdo not have exactlyDdimensions. - If
outputsandtargetsdo not have the same shape.
Auto Trait Implementations§
impl<B, const D: usize> Freeze for DiceInput<B, D>
impl<B, const D: usize> RefUnwindSafe for DiceInput<B, D>
impl<B, const D: usize> Send for DiceInput<B, D>
impl<B, const D: usize> Sync for DiceInput<B, D>
impl<B, const D: usize> Unpin for DiceInput<B, D>
impl<B, const D: usize> UnwindSafe for DiceInput<B, D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more