pub struct LBFGSState<B>where
B: Backend,{
pub history_s: Vec<Tensor<B, 1>>,
pub history_y: Vec<Tensor<B, 1>>,
pub d: Option<Tensor<B, 1>>,
pub t: Option<f64>,
pub prev_flat_grad: Option<Tensor<B, 1>>,
pub prev_loss: Option<f64>,
pub g_iter: usize,
}Expand description
L-BFGS optimizer state
Fields§
§history_s: Vec<Tensor<B, 1>>Historical displacement vectors
history_y: Vec<Tensor<B, 1>>Historical gradient difference vectors
d: Option<Tensor<B, 1>>Search direction
t: Option<f64>Step size from the previous iteration
prev_flat_grad: Option<Tensor<B, 1>>Flattened gradient from the previous iteration
prev_loss: Option<f64>Loss value from the previous iteration
g_iter: usizeGlobal iteration count
Implementations§
Source§impl<B> LBFGSState<B>where
B: Backend,
impl<B> LBFGSState<B>where
B: Backend,
Sourcepub fn to_device(self, device: &<B as BackendTypes>::Device) -> LBFGSState<B>
pub fn to_device(self, device: &<B as BackendTypes>::Device) -> LBFGSState<B>
Moves all historical tensors to the target device.
Trait Implementations§
Source§impl<B> Clone for LBFGSState<B>
impl<B> Clone for LBFGSState<B>
Source§fn clone(&self) -> LBFGSState<B>
fn clone(&self) -> LBFGSState<B>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<B> Default for LBFGSState<B>where
B: Backend,
impl<B> Default for LBFGSState<B>where
B: Backend,
Source§fn default() -> LBFGSState<B>
fn default() -> LBFGSState<B>
Returns the “default value” for a type. Read more
Source§impl<B> Record<B> for LBFGSState<B>where
B: Backend,
impl<B> Record<B> for LBFGSState<B>where
B: Backend,
Source§type Item<S: PrecisionSettings> = LBFGSStateItem<B, S>
type Item<S: PrecisionSettings> = LBFGSStateItem<B, S>
Type of the item that can be serialized and deserialized.
Source§fn into_item<S>(self) -> <LBFGSState<B> as Record<B>>::Item<S>where
S: PrecisionSettings,
fn into_item<S>(self) -> <LBFGSState<B> as Record<B>>::Item<S>where
S: PrecisionSettings,
Convert the current record into the corresponding item that follows the given settings.
Source§fn from_item<S>(
item: <LBFGSState<B> as Record<B>>::Item<S>,
device: &<B as BackendTypes>::Device,
) -> LBFGSState<B>where
S: PrecisionSettings,
fn from_item<S>(
item: <LBFGSState<B> as Record<B>>::Item<S>,
device: &<B as BackendTypes>::Device,
) -> LBFGSState<B>where
S: PrecisionSettings,
Convert the given item into a record.
Auto Trait Implementations§
impl<B> Freeze for LBFGSState<B>where
<B as BackendTypes>::FloatTensorPrimitive: Freeze,
<B as BackendTypes>::QuantizedTensorPrimitive: Freeze,
impl<B> RefUnwindSafe for LBFGSState<B>where
<B as BackendTypes>::FloatTensorPrimitive: RefUnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: RefUnwindSafe,
impl<B> Send for LBFGSState<B>
impl<B> Sync for LBFGSState<B>
impl<B> Unpin for LBFGSState<B>where
<B as BackendTypes>::FloatTensorPrimitive: Unpin,
<B as BackendTypes>::QuantizedTensorPrimitive: Unpin,
impl<B> UnsafeUnpin for LBFGSState<B>where
<B as BackendTypes>::FloatTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::QuantizedTensorPrimitive: UnsafeUnpin,
impl<B> UnwindSafe for LBFGSState<B>where
<B as BackendTypes>::FloatTensorPrimitive: UnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: UnwindSafe,
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