pub struct GraphBuilder<'a, T: Float + Send + Sync + 'static> { /* private fields */ }Expand description
Graph builder for fluent API 流暢なAPIのためのグラフビルダー
Implementations§
Source§impl<'a, T: Float + Send + Sync + 'static + ScalarOperand + FromPrimitive> GraphBuilder<'a, T>
impl<'a, T: Float + Send + Sync + 'static + ScalarOperand + FromPrimitive> GraphBuilder<'a, T>
Sourcepub fn new(context: &'a mut DynamicExecutionContext<T>) -> Self
pub fn new(context: &'a mut DynamicExecutionContext<T>) -> Self
Create new graph builder
Sourcepub fn add_input(&mut self, tensor: Tensor<T>) -> RusTorchResult<usize>
pub fn add_input(&mut self, tensor: Tensor<T>) -> RusTorchResult<usize>
Add input tensor
Sourcepub fn add_parameter(&mut self, tensor: Tensor<T>) -> RusTorchResult<usize>
pub fn add_parameter(&mut self, tensor: Tensor<T>) -> RusTorchResult<usize>
Add parameter tensor
Sourcepub fn add_operation(
&mut self,
op: DynamicOp,
inputs: Vec<usize>,
) -> RusTorchResult<usize>
pub fn add_operation( &mut self, op: DynamicOp, inputs: Vec<usize>, ) -> RusTorchResult<usize>
Add operation
Sourcepub fn linear(
&mut self,
input: usize,
weight: usize,
bias: Option<usize>,
) -> RusTorchResult<usize>
pub fn linear( &mut self, input: usize, weight: usize, bias: Option<usize>, ) -> RusTorchResult<usize>
Add linear layer
Sourcepub fn conv2d(
&mut self,
input: usize,
weight: usize,
kernel_size: (usize, usize),
stride: (usize, usize),
padding: (usize, usize),
) -> RusTorchResult<usize>
pub fn conv2d( &mut self, input: usize, weight: usize, kernel_size: (usize, usize), stride: (usize, usize), padding: (usize, usize), ) -> RusTorchResult<usize>
Add conv2d layer
Sourcepub fn relu(&mut self, input: usize) -> RusTorchResult<usize>
pub fn relu(&mut self, input: usize) -> RusTorchResult<usize>
Add ReLU activation
Sourcepub fn sigmoid(&mut self, input: usize) -> RusTorchResult<usize>
pub fn sigmoid(&mut self, input: usize) -> RusTorchResult<usize>
Add sigmoid activation
Sourcepub fn add(&mut self, input1: usize, input2: usize) -> RusTorchResult<usize>
pub fn add(&mut self, input1: usize, input2: usize) -> RusTorchResult<usize>
Add element-wise addition
Auto Trait Implementations§
impl<'a, T> Freeze for GraphBuilder<'a, T>
impl<'a, T> !RefUnwindSafe for GraphBuilder<'a, T>
impl<'a, T> Send for GraphBuilder<'a, T>
impl<'a, T> Sync for GraphBuilder<'a, T>
impl<'a, T> Unpin for GraphBuilder<'a, T>
impl<'a, T> !UnwindSafe for GraphBuilder<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more