Skip to content

Crash when first convert data type and then flip #137770

@qwerty10086

Description

@qwerty10086

🐛 Describe the bug

There is a float tensor in my progarm. When I first convert it to uint16 and then flip, the progarm crashes. I'm not sure whether this is a bug. Here is a minimum example:

#include <torch/torch.h>

int main()
{
    int Size = 4;
    auto T = torch::randn({ Size,Size,1 }, torch::dtype(torch::kFloat).device(torch::kCUDA));

    std::cout << T.flip(0) << std::endl; //No problem
    std::cout << T.to(torch::kInt16).flip(0) << std::endl; //No problem
    std::cout << T.flip(0).to(torch::kUInt16) << std::endl; //No problem
    std::cout << T.to(torch::kUInt16).flip(0) << std::endl; //Crash

    return 0;
}

Versions

Libtorch 2.3.1 with CUDA 11.8

Metadata

Metadata

Assignees

Labels

actionablemodule: unsigned intRelated to the new uint16, uint32, uint64 typestriagedThis 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