Skip to content

[bazel] cpp fronted nn.linear->to(int) throws exception, but Cmake tests pass #79871

@vors

Description

@vors

🐛 Describe the bug

Running this code throws an exception in bazel build

#include <torch/torch.h>
using namespace torch::nn;

int main() {
    Linear x(128, 64);
    x->to(torch::kInt32);
    return 0;
}
C++ exception with description "data set to a tensor that requires gradients must be floating point or complex dtype

This is tested in CMake build by this test:

module->to(torch::kInt32);

Versions

master 7d17e3b

cc @jbschlosser

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: bazelmodule: cppRelated to C++ APItriagedThis 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