pub struct TensorFlowAdam { /* private fields */ }Expand description
TensorFlow-compatible Adam optimizer
Implementations§
Source§impl TensorFlowAdam
impl TensorFlowAdam
Sourcepub fn new(
learning_rate: f64,
beta_1: f64,
beta_2: f64,
epsilon: f64,
weight_decay: Option<f64>,
clipnorm: Option<f64>,
clipvalue: Option<f64>,
global_clipnorm: Option<f64>,
use_ema: bool,
ema_momentum: f64,
jit_compile: bool,
name: Option<String>,
) -> Result<Self>
pub fn new( learning_rate: f64, beta_1: f64, beta_2: f64, epsilon: f64, weight_decay: Option<f64>, clipnorm: Option<f64>, clipvalue: Option<f64>, global_clipnorm: Option<f64>, use_ema: bool, ema_momentum: f64, jit_compile: bool, name: Option<String>, ) -> Result<Self>
Create new TensorFlow-compatible Adam optimizer
Sourcepub fn with_defaults() -> Result<Self>
pub fn with_defaults() -> Result<Self>
Create with default parameters
Sourcepub fn from_config(config: TensorFlowOptimizerConfig) -> Result<Self>
pub fn from_config(config: TensorFlowOptimizerConfig) -> Result<Self>
Create TensorFlow Adam optimizer from configuration
Sourcepub fn with_schedule(
schedule: Box<dyn TensorFlowLearningRateSchedule>,
beta_1: f64,
beta_2: f64,
epsilon: f64,
weight_decay: Option<f64>,
clipnorm: Option<f64>,
clipvalue: Option<f64>,
global_clipnorm: Option<f64>,
use_ema: bool,
ema_momentum: f64,
jit_compile: bool,
name: Option<String>,
) -> Result<Self>
pub fn with_schedule( schedule: Box<dyn TensorFlowLearningRateSchedule>, beta_1: f64, beta_2: f64, epsilon: f64, weight_decay: Option<f64>, clipnorm: Option<f64>, clipvalue: Option<f64>, global_clipnorm: Option<f64>, use_ema: bool, ema_momentum: f64, jit_compile: bool, name: Option<String>, ) -> Result<Self>
Create with learning rate schedule
Trait Implementations§
Source§impl TensorFlowOptimizer for TensorFlowAdam
impl TensorFlowOptimizer for TensorFlowAdam
Source§fn apply_gradients(
&mut self,
grads_and_vars: &[(Tensor, String)],
global_step: Option<i64>,
) -> Result<()>
fn apply_gradients( &mut self, grads_and_vars: &[(Tensor, String)], global_step: Option<i64>, ) -> Result<()>
Apply gradients to variables
Source§fn minimize(
&mut self,
loss_fn: Box<dyn Fn() -> Result<Tensor>>,
var_list: &[String],
global_step: Option<i64>,
) -> Result<Tensor>
fn minimize( &mut self, loss_fn: Box<dyn Fn() -> Result<Tensor>>, var_list: &[String], global_step: Option<i64>, ) -> Result<Tensor>
Minimize loss function
Source§fn get_config(&self) -> TensorFlowOptimizerConfig
fn get_config(&self) -> TensorFlowOptimizerConfig
Get optimizer configuration
Source§fn get_weights(&self) -> Vec<Tensor>
fn get_weights(&self) -> Vec<Tensor>
Get optimizer weights
Source§fn get_learning_rate(&self) -> f64
fn get_learning_rate(&self) -> f64
Get learning rate
Auto Trait Implementations§
impl Freeze for TensorFlowAdam
impl !RefUnwindSafe for TensorFlowAdam
impl Send for TensorFlowAdam
impl Sync for TensorFlowAdam
impl Unpin for TensorFlowAdam
impl !UnwindSafe for TensorFlowAdam
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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