use crate::affine::Affine2;
use crate::bounds::Bounds1;
use crate::star::Star2;
use crate::star_node::StarNodeType;
use crate::tensorshape::TensorShape;
use crate::NNVFloat;
use dyn_clone::DynClone;
use ndarray::{Array1, Array2};
use std::fmt::{Debug, Display};
#[typetag::serde(tag = "type")]
pub trait Layer: DynClone + Display + Debug + Send + Sync {
fn input_shape(&self) -> TensorShape {
panic!()
}
fn output_shape(&self) -> TensorShape {
panic!()
}
fn forward1(&self, input: &Array1<NNVFloat>) -> Array1<NNVFloat>;
fn forward2(&self, input: &Array2<NNVFloat>) -> Array2<NNVFloat>;
fn apply_bounds(
&self,
bounds: &Bounds1,
lower_aff: &Affine2,
upper_aff: &Affine2,
) -> (Bounds1, (Affine2, Affine2));
fn apply_bounds_step(
&self,
_dim: usize,
_bounds: &Bounds1,
_lower_aff: &Affine2,
_upper_aff: &Affine2,
) -> (Bounds1, (Affine2, Affine2)) {
panic!();
}
fn forward_star(
&self,
star: &Star2,
activation_idx: Option<usize>,
input_bounds: Option<Bounds1>,
parent_bounds: Option<Bounds1>,
) -> (Vec<Star2>, Vec<Option<Bounds1>>, bool);
fn construct_starnodetype(&self, child_ids: &[usize], dim: Option<usize>) -> StarNodeType;
fn input_dims(&self) -> usize {
self.input_shape().dims()
}
fn output_dims(&self) -> usize {
self.input_shape().dims()
}
fn is_activation(&self) -> bool {
false
}
fn get_activation_pattern(&self, _state: &Array2<NNVFloat>) -> Option<Array2<bool>> {
None
}
}
dyn_clone::clone_trait_object!(Layer);