pub mod activations;
pub mod concat;
pub mod conv;
pub mod element_wise;
pub mod execution;
pub mod factory;
pub mod input_buffer;
pub mod linear;
pub mod reshape;
use std::collections::HashMap;
use crate::{tensor::TensorDesc, tensor_graph::TensorId, utils::error::VKMLError};
use self::execution::LayerExecution;
pub trait Layer {
fn output_shapes(
&self,
batch_size: i64,
input_shapes: &[&TensorDesc],
) -> Result<Vec<TensorDesc>, VKMLError>;
fn requires_parameters(&self) -> bool {
self.parameter_count(0, &[]) > 0
}
fn parameter_shapes(&self, _input_shapes: &[&TensorDesc]) -> Option<(TensorDesc, TensorDesc)> {
None
}
fn parameter_count(&self, _batch_size: i64, _input_shapes: &[&TensorDesc]) -> i64 {
0
}
fn input_requirements(&self) -> (usize, Option<usize>);
fn name(&self) -> String;
fn config_string(&self) -> Option<String> {
None
}
fn in_features(&self) -> i64 {
0
}
fn out_features(&self) -> i64 {
0
}
fn map_input_tensors(&self, num_inputs: usize) -> HashMap<TensorId, (usize, TensorId)> {
let mut mappings = HashMap::new();
for i in 0..num_inputs {
mappings.insert(i, (i, 0)); }
mappings
}
fn build_layer_exec(
&self,
batch_size: i64,
input_shapes: &[&TensorDesc],
) -> Result<LayerExecution, VKMLError>;
}