INNER CODE UNIT · Rust

new

rustformers/llm · crates/ggml/src/lib.rs:346

    pub fn new(graph: &mut ComputationGraph, n_threads: usize) -> Self {
        Self {
            inner: unsafe { sys::ggml_graph_plan(graph.inner, usize_to_i32(n_threads)) },
            inner_graph: graph.inner,
        }
    }

    /// Creates a [Type::I8] work buffer with size `plan.work_size` for this [GraphExecutionPlan] in the given [Context].
    fn create_work_buffer(&mut self, context: &Context) -> Tensor {
        context.new_tensor_1d(Type::I8, self.inner.work_size)
    }

    /// Assign a work buffer to this [GraphExecutionPlan].
    fn assign_work_buffer(&mut self, buffer: &mut Tensor) {
        assert!(
            buffer.get_type() == Type::I8,
            "Work buffer must be of type i8"
        );

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…