Assigning value in a for loop is very slow

int main() 
{
    auto in = torch::full({9}, 0.0);
    for (int i = 0; i < 2000000; i++)
    {
        in[0] = 0.1;
    }

    return 0;
}

The above code takes 3000ms to run. But if I comment in[0] = 0.1;, it takes 0.005ms to run. Is it possible to make it faster?