/usr/local/lib64/python3.6/site-packages/torch/jit/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/torch/jit/__pycache__/quantized.cpython-36.pyc (18517B)
3
Eg] @ s d dl mZmZ d dlmZ d dl Z d dlZd dlmZmZm Z G dd de j
jZG dd de j
jZ
G d d
d
e j
jZG dd deZG d
d deZG dd deZd!eeeedddZG dd de j
jZG dd deZG dd deZdd Ze jfddZe jfdd ZdS )" )Tensor_VF)PackedSequenceN)ListOptionalTuplec s\ e Zd ZddgZ fddZejjdd Zejjdd Z ejjd d
Z
dd Z ZS )
QuantizedLinearscale
zero_pointc s t t| j |j| _|j| _tj|jjtj dj
\| _| _| _| _
tjj| jdd| _tjj| jdd| _|jd k stdtjj|jjtj dj
dd| _| jdtj| jjtj d d S )N)
memory_formatF)
requires_gradzQuantizedLinear requires a biaspacked_tensor_ptr)superr __init__in_featuresout_featurestorchfbgemm_linear_quantize_weightweightclonecontiguous_formatfloatcol_offsetsr r
nn ParameterbiasAssertionErrorregister_bufferfbgemm_pack_quantized_matrix)selfother) __class__ ?/usr/local/lib64/python3.6/site-packages/torch/jit/quantized.pyr
s &"zQuantizedLinear.__init__c C s | j jtj| j d S )N)r
set_r r r )r r" r" r# _unpack s zQuantizedLinear._unpackc C s. | j jtjtjjtt g tjdj d S )N)dtype)
r
r$ r zerosjitannotater intuint8detach)r r" r" r# _pack" s zQuantizedLinear._packc C s2 t j|j | j| j| j| j| j| j}|j |j
S )N)r Z)fbgemm_linear_int8_weight_fp32_activationr r r
r r r
r Ztor&