Skip to content

[feature request] accept Tensor as input or raise Warning for clip_grad_* #7760

@ruotianluo

Description

@ruotianluo

The current clip_grad_norm_ and clip_grad_value_ takes Iterable[Tensor] as input.

Is it better to support clip_grad_* to accept a single tensor as the input, and do clip on that tensor? For now, if we feed a tensor, it will be treated as an Iterable, which will result in no grads to clip.

Or, instead, should we raise a warning or error when the input is a tensor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions