Skip to content

possible max_grad_norm implementation error #1366

Description

@robertreaney

Clipping is currently applied after the optimizer step. The gradient clipping code controlled by the max-grad-norm cli param should be implemented between the backward and step calls.

Node Prediction Code

self.optimizer.zero_grad()
loss.backward()
rt_profiler.record('train_backward')
self.optimizer.step()
rt_profiler.record('train_step')
if max_grad_norm is not None:
th.nn.utils.clip_grad_norm_(model.parameters(), max_grad_norm, grad_norm_type)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions