Rounding only specific entries of torch.tensor()
Using torch.round() is it possible to eventually round specific entries of a tensor? Example:
tensor([ 8.5040e+00,  7.3818e+01,  5.2922e+00, -1.8912e-01,  5.4389e-01,
        -3.6032e-03,  4.5763e-01, -2.7471e-02])

Desired output:
tensor([ 9.,  74.,  5., 0.,  5.4389e-01,
        -3.6032e-03,  4.5763e-01, -2.7471e-02])

(Only first 4 rounded)

you can do as follow
a[:4]=torch.round(a[:4])

