id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
23,543
import torch from torch.autograd import Variable import math from nndct_shared.utils import NndctOption, NndctScreenLogger, QError from nndct_shared.quantization import kernel_need_quant from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import maybe_get_quantizer import pytorch_nndct...
null
23,544
import torch from torch.autograd import Variable import math from nndct_shared.utils import NndctOption, NndctScreenLogger, QError, QWarning from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from .quant_noise import eval_qnoise import pytorch_nndct.utils a...
null
23,545
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_Sub(torch.nn.Module): def __init__(self): def forward(self, input, other, alpha=1): def Sub(*args, **kwargs): return deephi_Sub(*...
null
23,546
import torch import numpy as np from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.utils import NndctOption from nndct_shared.base import GLOBAL_MAP, NNDCT_KEYS from .tanh_table import * from .fix_ops import NndctTanhTableLookup, NndctTanhS...
null
23,547
import math import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.utils import NndctOption from .fix_ops import NndctExpApprAIE2, NndctLogSoftmaxFastLn, NndctLogSoftmaxSub import pytorch_nndct.utils as py_utils class deephi_LogSof...
null
23,548
import math import torch import pytorch_nndct.utils as py_utils from nndct_shared.quantization import maybe_get_quantizer, quantize_tensors from nndct_shared.utils import NndctOption, NndctScreenLogger class deephi_AdaptiveAvgPool2d(torch.nn.modules.AdaptiveAvgPool2d): r"""DeePhi Conv2d operation, support float and d...
null
23,549
import os import re import torch from torch.autograd import Variable import math import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger, create_work_dir from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from .quant_noise import ev...
null
23,550
import torch from torch.autograd import Variable import torch.nn.functional as F from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.utils import NndctOption import pytorch_nndct.utils as py_utils from nndct_shared.utils import NNDCT_KEYS, ...
null
23,551
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils from nndct_shared.utils import NndctOption class deephi_LeakyReLU(torch.nn.LeakyReLU): r"""DeePhi LeakyReLU operation""" def __init__(self, *args, **kw...
null
23,552
import torch from torch.autograd import Variable from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_MaxPool1d(torch.nn.modules.MaxPool1d): r"""DeePhi Conv1d operation, support float and double""" def __...
null
23,553
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_Interpolate(torch.nn.Module): def __init__(self, *args, **kwards): super(deephi_Interpolate, self).__init__(*args, **kwards) self.no...
null
23,554
import torch from torch.autograd import Variable import math from nndct_shared.utils import NndctOption, NndctScreenLogger, QError, QWarning from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from .quant_noise import eval_qnoise import pytorch_nndct.utils a...
null
23,555
import torch from torch.autograd import Variable import math from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from .quant_noise import eval_qnoise import pytorch_nndct.utils as py_utils import ...
null
23,556
import torch from torch.autograd import Variable from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.utils import NndctOption from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_MaxPool2d(torch.nn.modules.MaxPool2d): r"""DeePhi Conv2d ope...
null
23,557
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,558
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,559
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,560
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,561
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,562
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,563
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,564
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,565
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,566
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,567
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,568
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,569
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,570
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,571
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,572
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,573
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,574
import os import torch import torch.nn.functional as F from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.base import NNDCT_CONSTANT from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import quant_r...
null
23,575
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_Mul(torch.nn.Module): def __init__(self): super(deephi_Mul, self).__init__() self.quant_mode, self.quantizer = maybe_get_quantizer()...
null
23,576
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.utils import NndctOption import pytorch_nndct.utils as py_utils from nndct_shared.utils import calculate_op_scale class deephi_Mean(torch.nn.Module): r"""DeePhi Concat operat...
null
23,577
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_Cat(torch.nn.Module): def __init__(self, *args, **kwargs): def forward(self, tensors, dim): def Cat(*args, **kwargs): return deep...
null
23,578
import numpy as np def mysigmoid(x): s = 1 / (1 + np.exp(-x)) return s
null
23,579
import numpy as np def mapping_sigm(x, data, shift): scale = 1.0 / 2 ** 15 inv_step = 2 ** shift def __ele_map(x_ele): scale = 2 ** -15 if x_ele >= 8: return 1.0 - scale elif x_ele < -8: return 0.0 else: x_ele = int(x_ele * inv_step) ...
null
23,580
import numpy as np def mapping_tanh(x, data, shift): scale = 1.0 / 2 ** 15 inv_step = 2 ** shift def __ele_map(x_ele): if x_ele >= 4: return 1.0 - scale elif x_ele < -4: return -1.0 else: x_ele = int(x_ele * inv_step) if x_ele >= 0: ...
null
23,581
import numpy as np def absolute_shift(x, pos, to='left', bitwidth=16): res = 0 if to == 'left': if pos >= 0: res = np.left_shift(x, pos) else: res = np.right_shift(x, -pos) elif to == 'right': if pos >= 0: res = np.right_shift(x, pos) else...
null
23,582
import numpy as np def absolute_shift_round(x, pos, to='left', bitwidth=16): res = 0 if to == 'left': if pos >= 0: #res = np.left_shift(x, pos) res = x * (2**pos) else: #res = np.right_shift(x, -pos) res = x * (2**(-pos)) elif to == 'right': ...
null
23,583
from typing import List, Tuple import torch from torch import Tensor from torch.nn.utils.rnn import (PackedSequence, pack_padded_sequence, pad_packed_sequence) from .rnn_cell import LSTMCell from .rnn_layer import LSTMLayer, QuantGruLayer, QuantLstmLayer def init_stacked_lstm(num_layers...
null
23,584
from typing import List, Tuple import torch from torch import Tensor from torch.nn.utils.rnn import (PackedSequence, pack_padded_sequence, pad_packed_sequence) from .rnn_cell import LSTMCell from .rnn_layer import LSTMLayer, QuantGruLayer, QuantLstmLayer class LSTM(torch.nn.Module): ...
null
23,585
import torch from torch.autograd import Variable import torch.nn.functional as F from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.utils import NndctOption import pytorch_nndct.utils as py_utils from .fix_ops import fake_quantize_per_tenso...
null
23,586
import torch from nndct_shared.utils import NndctOption from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_Embedding(torch.nn.modules.sparse.Embedding): r"""DeePhi transpose operation, support float and ...
null
23,587
import math import torch import numpy as np from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import kernel_need_quant from nndct_shared.quantization import quantize_tensors from nndct_shared.utils import NndctOption from .fix_ops import NndctSoftmaxExpApproximate, NndctSoftmaxLOD...
null
23,588
import torch from torch.autograd import Variable import math from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from .quant_noise import eval_qnoise import pytorch_nndct.utils as py_utils class de...
null
23,589
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.utils import NndctOption, NndctScreenLogger, QWarning from nndct_shared.quantization import kernel_need_quant from nndct_shared.quantization import quantize_tensors import numpy as np import pytorch_nndct.utils as py_utils from .f...
null
23,590
import torch from nndct_shared.quantization.utils import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_Matmul(torch.nn.Module): def __init__(self): def forward(self, input, other): def Matmul(*args, **kwargs): return deephi_Ma...
null
23,591
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
if Tinput.device == torch.device("cpu"): output = Tinput.cuda() nndct_kernels.FixNeuronV2(output, output, valmax, valamp, method) Tinput.copy_(output.cpu()) return Tinput # cpu fix neuron """ # output = Tinput.cpu().detach().numpy() # output = output * valamp # if method == 2: # output = np.where(output > valmax - 1, (...
23,592
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,593
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,594
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,595
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,596
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,597
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,598
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,599
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,600
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,601
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,602
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def support_onnx_...
null
23,603
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version import torch from tor...
null
23,604
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version import torch from tor...
null
23,605
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,606
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,607
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,608
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,609
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,610
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,611
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,612
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,613
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,614
import sys import torch from ..load_kernels import * import copy import numpy as np from nndct_shared.utils import NndctOption, NndctScreenLogger from pytorch_nndct.nn.utils.decorator import pre_and_post_process_f16_tensor from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version def clone_view_te...
null
23,615
import math import torch from torch.autograd import Variable from nndct_shared.quantization import maybe_get_quantizer, quantize_tensors from nndct_shared.utils import NndctOption import pytorch_nndct.utils as py_utils class deephi_AvgPool2d(torch.nn.modules.AvgPool2d): r"""DeePhi Conv2d operation, support float and ...
null
23,616
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.utils import NndctOption from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils class deephi_ReLU(torch.nn.ReLU): r"""DeePhi ReLU operation""" def __init__(self, *args, **kwargs): sup...
null
23,617
import torch from nndct_shared.quantization.utils import maybe_get_quantizer, quantize_tensors import pytorch_nndct.utils as py_utils class deephi_Add(torch.nn.Module): def __init__(self): super(deephi_Add, self).__init__() self.quant_mode, self.quantizer = maybe_get_quantizer() self.node = None def for...
null
23,618
import torch import numpy as np from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from nndct_shared.utils import NndctOption from nndct_shared.base import GLOBAL_MAP, NNDCT_KEYS from .sigmoid_table import * from .fix_ops import NndctSigmoidTableLookup, Nndc...
null
23,619
import torch from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.utils import NndctOption from nndct_shared.quantization import kernel_need_quant from nndct_shared.quantization import quantize_tensors import pytorch_nndct.utils as py_utils import numpy as np from pytorch_nndct.utils import Const...
null
23,620
import torch from torch.autograd import Variable import math from nndct_shared.utils import NndctOption, NndctScreenLogger, QError from nndct_shared.quantization import kernel_need_quant from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import maybe_get_quantizer import pytorch_nndct...
null
23,621
import torch.nn.functional as F import torch.nn as nn import torch from torch.nn.parameter import Parameter def get_same_padding(kernel_size): if isinstance(kernel_size, (tuple, list)): assert len(kernel_size) == 2, 'invalid kernel size: %s' % kernel_size p1 = get_same_padding(kernel_size[0]) p2 = get_sa...
null
23,622
import torch.nn.functional as F import torch.nn as nn import torch from torch.nn.parameter import Parameter def sub_filter_start_end(kernel_size, sub_kernel_size): center = kernel_size // 2 dev = sub_kernel_size // 2 start, end = center - dev, center + dev + 1 assert end - start == sub_kernel_size return sta...
null
23,623
import torch from torch.autograd import Variable import math from nndct_shared.utils import NndctOption, NndctScreenLogger from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from .quant_noise import eval_qnoise import pytorch_nndct.utils as py_utils import ...
null
23,624
import torch import math def eval_qnoise(output, res_f, efficency, deviation, rate, stop): error = torch.add(output, res_f, alpha=-1).data noise = error.pow(2).mean() if noise > 0: eff = 1.25 * res_f.pow(2).mean().div(noise).log10().detach().cpu().numpy() dev = math.fabs(eff - efficency) if dev > 0: ...
null
23,625
import torch from torch.autograd import Variable import math from nndct_shared.utils import NndctOption from nndct_shared.quantization import quantize_tensors from nndct_shared.quantization import maybe_get_quantizer import pytorch_nndct.utils as py_utils import torch.nn.functional as F class deephi_BatchNorm(torch.nn....
null
23,626
import torch import math from nndct_shared.utils import NndctOption, NndctScreenLogger, QError, QWarning from nndct_shared.quantization import maybe_get_quantizer from nndct_shared.quantization import quantize_tensors from .quant_noise import eval_qnoise import pytorch_nndct.utils as py_utils from .add import Add from...
null
23,627
class ApproxModes(object): NO_APPROX = 'no_approx' EXP_POLY = 'exp_poly' EXP_LUT = 'exp_lut' QIO = 'quant_input_output' def is_no_approx(mode): return mode == ApproxModes.NO_APPROX
null
23,628
class ApproxModes(object): NO_APPROX = 'no_approx' EXP_POLY = 'exp_poly' EXP_LUT = 'exp_lut' QIO = 'quant_input_output' def is_exp_poly(mode): return mode == ApproxModes.EXP_POLY
null
23,629
class ApproxModes(object): NO_APPROX = 'no_approx' EXP_POLY = 'exp_poly' EXP_LUT = 'exp_lut' QIO = 'quant_input_output' def is_exp_lut(mode): return mode == ApproxModes.EXP_LUT
null
23,630
class ApproxModes(object): def is_quant_input_output(mode): return mode == ApproxModes.QIO
null
23,631
class ApproxModes(object): NO_APPROX = 'no_approx' EXP_POLY = 'exp_poly' EXP_LUT = 'exp_lut' QIO = 'quant_input_output' def available_modes(): return [ApproxModes.NO_APPROX, ApproxModes.EXP_POLY, ApproxModes.EXP_LUT]
null
23,632
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch...
null
23,633
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal def ploy_HORNER_SCHEME(r, cs, degree): out = mult_add(r, cs[degr...
null
23,634
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal def ploy_HORNER_SCHEME(r, cs, degree): out = mult_add(r, cs[degr...
null
23,635
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch...
null
23,636
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch...
null
23,637
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch...
null
23,638
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch...
null
23,639
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch...
null
23,640
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch...
null
23,641
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal def ploy_HORNER_SCHEME(r, cs, degree): out = mult_add(r, cs[degr...
null
23,642
import torch import numpy as np from .coefficient import get_sigmoid_positive_ploy_coeffcients, get_exp_poly_coeffcients, get_gelu_tanh_poly_coeffcients, get_tanh_positive_poly_coeffcients from pytorch_nndct.utils.hw_dtype import is_subnormal, is_normal from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch...
null