use ::burn::tensor::{Tensor, backend::Backend};
use crate::base::geometry::Command;
pub type Arguments<B> = Tensor<B, 3>;
#[derive(Clone)]
pub struct Contour<B: Backend> {
commands: Vec<Command>,
arguments: Arguments<B>,
}
impl<B: Backend> Contour<B> {
pub fn new(commands: Vec<Command>, arguments: Arguments<B>) -> Self {
assert!(
commands.len() == arguments.dims()[0],
"command count must match contour argument count"
);
Self {
commands,
arguments,
}
}
pub fn arguments(&self) -> Arguments<B> {
self.arguments.clone()
}
pub fn command(&self, index: usize) -> Command {
self.commands[index]
}
pub fn commands(&self) -> &[Command] {
&self.commands
}
pub fn detach(&self) -> Self {
Self {
commands: self.commands.clone(),
arguments: self.arguments.clone().detach(),
}
}
pub fn device(&self) -> B::Device {
self.arguments.device()
}
pub fn dims(&self) -> [usize; 3] {
self.arguments.dims()
}
}