id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
23,643
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,644
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version from torch.nn import init from torch.nn.modules.utils import _pair from torch.nn.modules.utils import _triple from torch.nn.parameter import Parame...
null
23,645
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version from torch.nn import init from torch.nn.modules.utils import _pair from torch.nn.modules.utils import _triple from torch.nn.parameter import Parame...
null
23,646
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version from torch.nn import init from torch.nn.modules.utils import _pair from torch.nn.modules.utils import _triple from torch.nn.parameter import Parame...
null
23,647
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.utils.torch_utils import CmpFlag, compare_torch_version from torch.nn import init from torch.nn.modules.utils import _pair from torch.nn.modules.utils import _triple from torch.nn.parameter import Parame...
null
23,648
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.modules import fix_ops from pytorch_nndct.nn.quantization.ops import tqt_ops class FakeQuantizer(nn.Module): def __init__(self, bitwidth): def forward(self, x): def _save_to_state_dict(...
null
23,649
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.modules import fix_ops from pytorch_nndct.nn.quantization.ops import tqt_ops class FakeQuantizer(nn.Module): """Simulate the quantize and dequantize operations in training time. In general, the ou...
null
23,650
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.modules import fix_ops from pytorch_nndct.nn.quantization.ops import tqt_ops class TQTQuantizer(FakeQuantizer): def __init__(self, bitwidth, tensor_type, method = None): super(TQTQuantizer, self...
null
23,651
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.modules import fix_ops from pytorch_nndct.nn.quantization.ops import tqt_ops class TQTQuantizer(FakeQuantizer): def __init__(self, bitwidth, tensor_type, method = None): super(TQTQuantizer, self...
null
23,652
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.modules import fix_ops from pytorch_nndct.nn.quantization.ops import tqt_ops class TQTQuantizer(FakeQuantizer): def __init__(self, bitwidth, tensor_type, method = None): super(TQTQuantizer, self...
null
23,653
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.modules import fix_ops from pytorch_nndct.nn.quantization.ops import tqt_ops class TQTQuantizer(FakeQuantizer): def __init__(self, bitwidth, tensor_type, method = None): super(TQTQuantizer, self...
null
23,654
import torch from pytorch_nndct.utils.hw_dtype import fp32 from pytorch_nndct.nn.quantization.ops import quantize_ops def get_exponent(tensor): with torch.no_grad(): t = torch.nan_to_num(tensor, nan=0, posinf=0, neginf=0) ''' smallest positive subnormal, largest subnormal, smallest positive normal, larges...
null
23,655
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def _get_exponent_v1(tensor, epsilon=2**-23): t = tensor.abs() # we use fp32's 1.mantissa_bits max_t, _ = t.max(t.dim() - 1, keepdim=True) max...
null
23,656
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def _get_exponent_v2(tensor): _, exp = torch.frexp(tensor) # we use fp32's 1.mantissa_bits max_exp, _ = exp.max(exp.dim() - 1, keepdim=True) r...
null
23,657
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def _get_exponent_v3(tensor): tensor_shape = list(tensor.shape) exponent = torch.ops.vai.calculate_shared_exponent(tensor, tensor_shape[-1]) ten...
null
23,658
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def _min_max_at_exp(exp, bit_width): # sign bits: 1, exponent bits: 8, no implicit leading 1 mantissa_bits = bit_width - 9 # The min/max represe...
null
23,659
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def transform_to_block_wise(input, block_size=8, axis=1): def transform_block_to_shape(input, shape, axis=1): class BFPQuantizeV1(torch.autograd.Functi...
null
23,660
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def transpose_to_block_wise(input, block_size=8, axis=1): def transpose_block_to_shape(input, shape, axis=1): class BFPQuantizeV2(BFPQuantize): de...
null
23,661
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def pad_to_block_last(tensor, block_size=8, axis=1): def depad_and_transpose(tensor, shape, axis=1): class BFPQuantizeV3(BFPQuantize): def forward...
null
23,662
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def transform_to_block_wise(input, block_size=8, axis=1): def transform_block_to_shape(input, shape, axis=1): def quantize_to_bfp_prime(tensor, ...
null
23,663
import torch import torch.nn as nn import torch.nn.functional as F from pytorch_nndct.nn.quantization.ops import quantize_ops from pytorch_nndct.utils import onnx_utils def pad_to_block_last(tensor, block_size=8, axis=1): def depad_and_transpose(tensor, shape, axis=1): class BFPPrimeSharedQuantize(BFPQuantize): de...
null
23,664
import math import numpy as np import torch from pytorch_nndct.nn.modules import fix_ops The provided code snippet includes necessary dependencies for implementing the `_cdf_measure` function. Write a Python function `def _cdf_measure(x, y, measure_name='Kullback-Leibler-J')` to solve the following problem: Ref paper:...
Ref paper: "Non-parametric Information-Theoretic Measures of One-Dimensional Distribution Functions from Continuous Time Series" - Paolo D Alberto et al. https://epubs.siam.org/doi/abs/10.1137/1.9781611972795.59 https://epubs.siam.org/doi/pdf/10.1137/1.9781611972795.59 measure_names_symm = ['Camberra', 'Chi-Squared', '...
23,665
from functools import wraps import torch def pre_and_post_process_f16_tensor(func): @wraps(func) def wrapper(*args, **kwargs): tensor_type_list = [] tensor_type_dict = {} out_need_convert = False for arg in args: if isinstance(arg, torch.Tensor): tensor_type_list.append(arg.dtype) ...
null
23,666
import torch import numpy as np from torch.nn.utils.rnn import PackedSequence import torch.nn as nn def deephi_pack_padded_sequence(input, lengths, batch_first=False): if isinstance(lengths, list): lengths = torch.LongTensor(lengths) data = input if not batch_first: batch_sizes = np.ones(input.size(0)) * ...
null
23,667
import torch import numpy as np from torch.nn.utils.rnn import PackedSequence import torch.nn as nn def deephi_pad_packed_sequence(sequence, batch_first=False, padding_value=0.0, total_length=None): output = sequence if not...
null
23,668
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,669
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,670
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,671
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,672
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,673
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,674
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,675
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,676
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,677
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,678
import copy import importlib import os import random import string import sys import tempfile import torch from torch.nn import DataParallel from torch.nn.parallel import DistributedDataParallel from nndct_shared.nndct_graph.base_tensor import Tensor from nndct_shared.pruning import errors from pytorch_nndct import par...
null
23,679
import collections import copy import json import numpy as np import os import random import torch import torch.multiprocessing as mp import types from typing import List from nndct_shared.base import NNDCT_OP as OpTypes from nndct_shared.pruning import errors from nndct_shared.pruning import logging from nndct_shared....
null
23,680
import collections import copy import json import numpy as np import os import random import torch import torch.multiprocessing as mp import types from typing import List from nndct_shared.base import NNDCT_OP as OpTypes from nndct_shared.pruning import errors from nndct_shared.pruning import logging from nndct_shared....
null
23,681
import collections import copy import json import numpy as np import os import random import torch import torch.multiprocessing as mp import types from typing import List from nndct_shared.base import NNDCT_OP as OpTypes from nndct_shared.pruning import errors from nndct_shared.pruning import logging from nndct_shared....
Returns a slim state dict in which the weight names are same with the original model and the tensors are pruned to slim ones.
23,682
import collections import copy import json import numpy as np import os import random import torch import torch.multiprocessing as mp import types from typing import List from nndct_shared.base import NNDCT_OP as OpTypes from nndct_shared.pruning import errors from nndct_shared.pruning import logging from nndct_shared....
Fill 0 in removed channels.
23,683
import collections import copy import json import numpy as np import os import random import torch import torch.multiprocessing as mp import types from typing import List from nndct_shared.base import NNDCT_OP as OpTypes from nndct_shared.pruning import errors from nndct_shared.pruning import logging from nndct_shared....
null
23,684
import collections import copy import json import numpy as np import os import random import torch import torch.multiprocessing as mp import types from typing import List from nndct_shared.base import NNDCT_OP as OpTypes from nndct_shared.pruning import errors from nndct_shared.pruning import logging from nndct_shared....
null
23,685
from collections import ChainMap, defaultdict from enum import Enum from tqdm import tqdm import torch from nndct_shared.base.key_names import FrameworkType from nndct_shared.nndct_graph import (Graph, Tensor, Block, Node, reorder_multi_subgraph_nodes) from nndct_shared.utils impor...
null
23,686
from nndct_shared.nndct_graph.base_tensor import Tensor from pytorch_nndct.utils import TorchGraphSymbol from .rich_in_out_helper import FlattenInOutModelForTrace def convert_np_type_to_pytorch_type(np_type): return { 'int64': 'torch.int64', 'int32': 'torch.int32', 'float32': 'torch.float', 'float64': 'torch...
null
23,687
from nndct_shared.nndct_graph.base_tensor import Tensor from pytorch_nndct.utils import TorchGraphSymbol from .rich_in_out_helper import FlattenInOutModelForTrace def convert_dtype_between_np_and_pytorch(dtype): return { 'int64': 'torch.int64', 'int32': 'torch.int32', 'float32': 'torch.float', 'float64': 'to...
null
23,688
from nndct_shared.nndct_graph.base_tensor import Tensor from pytorch_nndct.utils import TorchGraphSymbol from .rich_in_out_helper import FlattenInOutModelForTrace _GRAPH_SCOPE_SYM = TorchGraphSymbol.GRAPH_SCOPE_SYM class FlattenInOutModelForTrace(torch.nn.Module): def getModelName(cls): return 'FlattenInOutM...
get the full name of node/tensor in graph Args: graph_name (str): graph name Returns: str: full name
23,689
from nndct_shared.nndct_graph.base_tensor import Tensor from pytorch_nndct.utils import TorchGraphSymbol from .rich_in_out_helper import FlattenInOutModelForTrace def get_short_name(full_name: str) -> str: """get the name of node/tensor in graph without graph name Args: full_name (str): full name of node/tens...
replace `.` with `_` Args: hier_name (str): "layer_0.layer_1" Returns: str: "layer_0_layer_1"
23,690
from nndct_shared.nndct_graph.base_tensor import Tensor from pytorch_nndct.utils import TorchGraphSymbol from .rich_in_out_helper import FlattenInOutModelForTrace class TorchScriptModuleHandler(object): def __init__(self): def build_torch_graph(self, graph_name, script_module, *args): def rename_graph_i...
null
23,691
from nndct_shared.nndct_graph.base_tensor import Tensor from pytorch_nndct.utils import TorchGraphSymbol from .rich_in_out_helper import FlattenInOutModelForTrace class Tensor(object): """A wrapper of np.ndarray used in two ways: - The outputs of an operation. - The parameters of an operation. In the former ca...
null
23,692
import torch import torch import math import functools from nndct_shared.utils import (AddXopError, NndctOption, NndctScreenLogger, option_util, QError, QWarning) HANDLED_FUNCTIONS = {} The provided code snippet includes necessary dependencies for implementing the `implements` function....
Register a torch function override for ScalarTensor
23,693
import torch import torch import math import functools from nndct_shared.utils import (AddXopError, NndctOption, NndctScreenLogger, option_util, QError, QWarning) def convert_tensor_to_tracetensor(data): if isinstance(data, torch.Tensor): return TraceTensor(data.detach().cpu(...
null
23,694
import torch import torch import math import functools from nndct_shared.utils import (AddXopError, NndctOption, NndctScreenLogger, option_util, QError, QWarning) class TraceTensor(torch.Tensor): def __torch_function__(cls, func, types, args=(), kwargs=None): def split(tensor:Trace...
null
23,695
import torch import torch import math import functools from nndct_shared.utils import (AddXopError, NndctOption, NndctScreenLogger, option_util, QError, QWarning) class TraceTensor(torch.Tensor): def __torch_function__(cls, func, types, args=(), kwargs=None): if kwargs is None: ...
null
23,696
import torch import torch import math import functools from nndct_shared.utils import (AddXopError, NndctOption, NndctScreenLogger, option_util, QError, QWarning) def logging_warn(message): NndctScreenLogger().warning2user(QWarning.FLOAT_OP, message) class TraceTensor(torch.Tensor): ...
null
23,697
import torch import torch import math import functools from nndct_shared.utils import (AddXopError, NndctOption, NndctScreenLogger, option_util, QError, QWarning) def logging_warn(message): NndctScreenLogger().warning2user(QWarning.FLOAT_OP, message) class TraceTensor(torch.Tensor): ...
null
23,698
import torch import torch import math import functools from nndct_shared.utils import (AddXopError, NndctOption, NndctScreenLogger, option_util, QError, QWarning) def logging_warn(message): class TraceTensor(torch.Tensor): def __torch_function__(cls, func, types, args=(), kwargs=Non...
null
23,699
import torch import torch import math import functools from nndct_shared.utils import (AddXopError, NndctOption, NndctScreenLogger, option_util, QError, QWarning) def clear_override_import_redundant_op(graph): # remove alias alias_node_list = graph.findAllNodes("aten::alias") ...
null
23,700
from .op_dispatcher import * from .parse_utils import * def change_addmm_to_linear(raw_graph): for node in raw_graph.nodes: if node.op.type in [NNDCT_OP.ADDMM]: weight = node.op.get_config('mat2') bias = node.op.get_config('input') if (weight and weight.node == None) and (bias and bias.node == ...
null
23,701
import re import torch import collections from typing import List, Dict from dataclasses import dataclass class HandleListType(Schema): schemas: List[Schema] sizes: List[int] def __call__(self, values): values = self._split(values, self.sizes) if len(values) != len(self.schemas): ...
null
23,702
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,703
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,704
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,705
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,706
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,707
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,708
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,709
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,710
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,711
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,712
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,713
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,714
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,715
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,716
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,717
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,718
import math import numpy as np from nndct_shared.base import NNDCT_OP from nndct_shared.utils import PatternType from nndct_shared.nndct_graph import GraphSearcher, Tensor from pytorch_nndct.parse.torch_op_def import TorchConvTranspose2d, TorchConv2d from .device import DeviceInfo, DeviceType from .target_helper import...
null
23,719
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape _OP_CONVERTER_DICT = {} def create_op(gm, op, targe...
null
23,720
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape _OP_CONVERTER_DICT = {} OpConvertInfo = namedtuple("...
null
23,721
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def input_arg(*args, **kwargs): op = TorchBaseOpe...
null
23,722
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def call_method(*args, **kwargs): op = TorchBaseO...
null
23,723
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def call_module(*args, **kwargs): op = TorchBaseO...
null
23,724
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def call_function(*args, **kwargs): op = TorchBas...
null
23,725
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def output(*args, **kwargs): op = TorchBaseOperat...
null
23,726
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def int2tuple(obj, tuple_size): def convert_real_ten...
null
23,727
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def _convolution(input, weight, bias, stride, paddin...
null
23,728
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def relu(*, input, inplace): # s op = TorchReLU...
null
23,729
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def convert_real_tensor(name, real_tensor): if rea...
null
23,730
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def linear(*, input, weight, bias): op = TorchLin...
null
23,731
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def flatten(*, input, start_dim, end_dim): op = T...
null
23,732
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def adaptive_avg_pool2d(*, input, output_size): ...
null
23,733
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def int2tuple(obj, tuple_size): if isinstance(obj,...
null
23,734
import numbers from collections import namedtuple import torch from nndct_shared.base import NNDCT_OP from nndct_shared.nndct_graph import Tensor from pytorch_nndct.parse.torch_op_def import * from pytorch_nndct.fx.translator_utils import convert_dtype, convert_shape def add(*, input, other, alpha): op = TorchAdd() ...
null
23,735
import torch from collections import OrderedDict from nndct_shared.nndct_graph import Graph, Block, Node, Tensor from pytorch_nndct.fx.convert_op import create_op from pytorch_nndct.fx.translator_utils import convert_dtype, get_meta_info, convert_shape import nndct_shared.utils.tensor_util as tensor_util from nndct_sha...
null
23,736
import torch from collections import OrderedDict from nndct_shared.nndct_graph import Graph, Block, Node, Tensor from pytorch_nndct.fx.convert_op import create_op from pytorch_nndct.fx.translator_utils import convert_dtype, get_meta_info, convert_shape import nndct_shared.utils.tensor_util as tensor_util from nndct_sha...
null
23,737
import torch from collections import OrderedDict from nndct_shared.nndct_graph import Graph, Block, Node, Tensor from pytorch_nndct.fx.convert_op import create_op from pytorch_nndct.fx.translator_utils import convert_dtype, get_meta_info, convert_shape import nndct_shared.utils.tensor_util as tensor_util from nndct_sha...
null
23,738
import operator import itertools import torch from pytorch_nndct.fx.optimization.utils import replace_node def always_true(*args, **kwargs): return True
null
23,739
import copy import os from typing import Any, Optional, Sequence, Union, List, Dict, Tuple import torch from nndct_shared.utils import NndctScreenLogger, NndctOption, QError, QWarning, QNote from .qproc import TorchQuantProcessor from .qproc import base as qp from .qproc import LSTMTorchQuantProcessor, RNNQuantProcesso...
null
23,740
from nndct_shared.utils import set_option_value, NndctOption from pytorch_nndct.qproc.utils import (get_deploy_graph_list, prepare_quantizable_module, register_output_hook, set_outputs_recorder_status, t...
null
23,741
from nndct_shared.utils import set_option_value, NndctOption from pytorch_nndct.qproc.utils import (get_deploy_graph_list, prepare_quantizable_module, register_output_hook, set_outputs_recorder_status, t...
null
23,742
import importlib.util import os import sys from typing import Any, NoReturn, Optional, Sequence, Tuple, Union, List import itertools import torch import torch.nn as nn import torch.nn.functional as F import nndct_shared.utils as nndct_utils import pytorch_nndct.utils.jit_utils as jit_utils import pytorch_nndct.utils.mo...
null