You can use pytorch/observer.py at master · pytorch/pytorch · GitHub 3, this is also what the official quantization flows use.  For example,
obs = torch.quantization.MinMaxObserver(...)
# run data through the observer
obs(your_tensor)
# get scale and zp from the data observer has seen
scale, zp = obs.calculate_qparams()

One other thing to consider could be using fp16, that way you could just do x.half() without worrying about quantization params.