leibniz 0.1.0

The package provides a differentiable vector graphics rasterization loss.
Documentation
//! Tensor aliases.

use ::burn::tensor::{Tensor, backend::Backend};

/// Grayscale targets with shape `[layouts, height, width]`.
pub type Targets<B> = Tensor<B, 3>;

/// Scalar value with shape `[1]`.
pub type Value<B> = Tensor<B, 1>;

pub(crate) fn column<B: Backend>(values: Tensor<B, 2>, index: usize) -> Tensor<B, 1> {
    let row_count = values.dims()[0];

    values
        .slice([0..row_count, index..index + 1])
        .squeeze_dim::<1>(1)
}

pub(crate) fn expand<B: Backend>(values: Tensor<B, 1>) -> Tensor<B, 2> {
    values.unsqueeze_dim::<2>(1).repeat_dim(1, 2)
}