Skip to content

torch::autograd::Function should set AutoNonVariableTypeMode when running forward #40736

@ezyang

Description

@ezyang

Currently, it does not, which means you cannot write idiomatic redispatch as:

  static torch::autograd::variable_list forward(
      torch::autograd::AutogradContext* ctx,
      torch::autograd::Variable input,
      torch::autograd::Variable rois,
      ...) {
    ctx->saved_data["spatial_scale"] = spatial_scale;
    ...
    // at::AutoNonVariableTypeMode g;
    auto result = roi_align(
        input,
        rois,
        ...

You have to add the AutoNonVariableTypeMode guard yourself. This should have been taken care of in Function.

cc @ezyang @ssnl @albanD @zou3519 @gqchen

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: autogradRelated to torch.autograd, and the autograd engine in generaltriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions