Good to know this was a workaround.
However, I’m able to use the numpy array directly without triggering a copy:
pts = np.array([[[ 17, 153]],
                [[153, 154]],
                [[159, 692]],
                [[ 14, 691]]], dtype=np.int32)

x = torch.randn(768, 256, 3)
img = x.numpy()
cv2.polylines(img, [pts], True, (0, 1, 1))