Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Set _scale in Trainer using Optimizer rescale_grad #14593

Merged
merged 1 commit into from
Apr 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/mxnet/gluon/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ def __init__(self, params, optimizer, optimizer_params=None, kvstore='device',
if param._grad_stype != 'default':
self._contains_sparse_grad = True
self._compression_params = compression_params
optimizer_params = optimizer_params if optimizer_params else {}
self._scale = float(optimizer_params.get('rescale_grad', 1.0))
self._contexts = self._check_contexts()
optimizer_params = optimizer_params if optimizer_params else {}
self._init_optimizer(optimizer, optimizer_params)
self._scale = self._optimizer.rescale_grad
self._kvstore_params = {'kvstore': kvstore, 'update_on_kvstore': update_on_kvstore}
self._kv_initialized = False
self._kvstore = None
Expand Down