'How do I convert float tensor into binary tensor using PyTorch?

I have a tensor and want to convert in into a Quantized Binary form.

x= torch.Tensor([-9.0387e-01, 1.4811e-01, 2.8242e-01, 3.6679e-01, 3.2012e-01])



Solution 1:[1]

PyTorch only supports qint8 type. You can convert the tensor to a quantized version with torch.quantize_per_tensor, you can check the wiki here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Deusy94