SGD

Customizes the SGD optimizer.

Prototype

1
def create_hash_optimizer(learning_rate, use_locking=False, name="GradientDescent", use_fusion_optim=False, weight_decay=None)

Parameters

Parameter

Type

Mandatory/Optional

Description

learning_rate

float/tf.Tensor

Mandatory

Learning rate

Value range: [0.0, 10.0]

use_locking

bool

Optional

Prevents concurrent updates of variables.

Default value: False

Value range:

  • True
  • False

name

string

Optional

Name of the optimizer

Default value: GradientDescent

Name length range: [1, 200]

use_fusion_optim

bool

Optional

Whether to enable operator acceleration.

Default value: False

Value range:

  • True: Enable operator fusion acceleration.
  • False: Disable this function.

weight_decay

float

Optional

Weight decay coefficient.

Default value: None, indicating that weight decay is disabled.

Value range: [1e-5, 1e-2]

Return Value

An instance object of the CustomizedGradientDescent optimizer.

Example

1
2
from mx_rec.optimizers.gradient_descent import create_hash_optimizer
hashtable_optimizer = create_hash_optimizer(0.001)