nd2py package#
- class nd2py.Empty(nettype: Literal['node', 'edge', 'scalar'] | None = None)[source]#
Bases:
Symbol- n_operands = 0#
- __init__(nettype: Literal['node', 'edge', 'scalar'] | None = None)[source]#
Initialize a Symbol node.
This constructor sets the nettype, sanitizes and attaches child operands, and then triggers a nettype inference pass on the whole expression tree.
- Parameters:
*operands – Child operands of this symbol. The number of operands must match
n_operandsof the concrete subclass. Non-symbol scalar values are automatically wrapped asNumbersymbols.nettype (Optional[NetType | Set[NetType]]) – Nettype constraint for this symbol, such as
"node","edge", or"scalar", or a set of allowed nettypes. If provided, it is propagated through the tree byinfer_nettype().
- map_nettype() Literal['node', 'edge', 'scalar'] | None[source]#
Default nettype mapping rule for symbol subclasses.
The default behavior enforces that
"node"and"edge"nettypes cannot be mixed. If only scalars are present, the result is"scalar"; otherwise it follows the presence of"node"or"edge".- Parameters:
*children_nettypes (NetType) – Nettypes of the child operands.
- Returns:
Inferred nettype for the parent symbol, or
Noneif the combination is invalid or cannot be determined.- Return type:
Optional[NetType]
- Raises:
ValueError – If the number of child nettypes does not match
cls.n_operands.
- class nd2py.Csch(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Sour(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- classmethod map_nettype(*children_nettypes: Literal['node', 'edge', 'scalar']) Literal['node', 'edge', 'scalar'] | None[source]#
Default nettype mapping rule for symbol subclasses.
The default behavior enforces that
"node"and"edge"nettypes cannot be mixed. If only scalars are present, the result is"scalar"; otherwise it follows the presence of"node"or"edge".- Parameters:
*children_nettypes (NetType) – Nettypes of the child operands.
- Returns:
Inferred nettype for the parent symbol, or
Noneif the combination is invalid or cannot be determined.- Return type:
Optional[NetType]
- Raises:
ValueError – If the number of child nettypes does not match
cls.n_operands.
- class nd2py.Csc(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Cot(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Add(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 2#
- class nd2py.LogAbs(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Rgga(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Aggr
- class nd2py.Sec(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Identity(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Cosh(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.FoldConstant(fold_fitable: bool = True, fold_constant: bool = True)[source]#
Bases:
Visitor访问器,用于将表达式中不含 Number 的子表达式折叠为 Constant。
- class nd2py.Min(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 2#
- nd2py.Constant(value, nettype: Literal['node', 'edge', 'scalar'] = 'scalar') Number[source]#
一个工厂函数,返回一个 fitable 为 False 的 Number 对象。
- nd2py.parse(expression: str, variables: Dict[str, Symbol] = None, callables: Dict[str, callable] = None) Symbol[source]#
- nd2py.warn_once(warn_name, maxsize=None)[source]#
This function is used to limit the number of times a warning is issued
- nd2py.setup_lazy_imports(module_name: str, import_mapping: Dict[str, Tuple[str, str]])[source]#
Set up lazy imports for a module’s
__init__.py.Returns
(__getattr__, __dir__, __all__)which should be assigned at the module level so thatfrom package import OptionalClassworks without importing the optional dependency until it is actually needed.- Parameters:
module_name – The
__name__of the calling module.import_mapping – A dict mapping attribute names to
(module_path, requires)tuples. module_path is a relative import path (e.g.".torch_calc") and requires is the optional-dependency group name (e.g."nn") shown in the error message when the dependency is missing.
Usage:
# __init__.py from .core import CoreClass from ..utils.lazy_loader import setup_lazy_imports if TYPE_CHECKING: from .optional import OptionalClass __getattr__, __dir__, __all__ = setup_lazy_imports(__name__, { "OptionalClass": (".optional", "nn"), })
- class nd2py.Inv(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Aggr(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- classmethod map_nettype(*children_nettypes: Literal['node', 'edge', 'scalar']) Literal['node', 'edge', 'scalar'] | None[source]#
Default nettype mapping rule for symbol subclasses.
The default behavior enforces that
"node"and"edge"nettypes cannot be mixed. If only scalars are present, the result is"scalar"; otherwise it follows the presence of"node"or"edge".- Parameters:
*children_nettypes (NetType) – Nettypes of the child operands.
- Returns:
Inferred nettype for the parent symbol, or
Noneif the combination is invalid or cannot be determined.- Return type:
Optional[NetType]
- Raises:
ValueError – If the number of child nettypes does not match
cls.n_operands.
- class nd2py.Cos(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Regular(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 2#
- class nd2py.Pow(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 2#
- nd2py.variables(vars, *args, **kwargs)[source]#
一个工厂函数,返回一个或多个 Variable 对象。 如果 vars 中包含空格,则认为是多个变量的名字,并返回一个列表;否则认为是单个变量的名字,并返回一个 Variable 对象。
- class nd2py.Number(value, nettype: Literal['node', 'edge', 'scalar'] = 'scalar', fitable=None)[source]#
Bases:
Symbol- n_operands = 0#
- __init__(value, nettype: Literal['node', 'edge', 'scalar'] = 'scalar', fitable=None)[source]#
Initialize a Symbol node.
This constructor sets the nettype, sanitizes and attaches child operands, and then triggers a nettype inference pass on the whole expression tree.
- Parameters:
*operands – Child operands of this symbol. The number of operands must match
n_operandsof the concrete subclass. Non-symbol scalar values are automatically wrapped asNumbersymbols.nettype (Optional[NetType | Set[NetType]]) – Nettype constraint for this symbol, such as
"node","edge", or"scalar", or a set of allowed nettypes. If provided, it is propagated through the tree byinfer_nettype().
- map_nettype() Literal['node', 'edge', 'scalar'] | None[source]#
Default nettype mapping rule for symbol subclasses.
The default behavior enforces that
"node"and"edge"nettypes cannot be mixed. If only scalars are present, the result is"scalar"; otherwise it follows the presence of"node"or"edge".- Parameters:
*children_nettypes (NetType) – Nettypes of the child operands.
- Returns:
Inferred nettype for the parent symbol, or
Noneif the combination is invalid or cannot be determined.- Return type:
Optional[NetType]
- Raises:
ValueError – If the number of child nettypes does not match
cls.n_operands.
- get_nettype_range() Set[Literal['node', 'edge', 'scalar']][source]#
获取此节点可能产生的所有 nettype 值域,并在首次调用时缓存到类属性中。
- property nettype_range: Set[Literal['node', 'edge', 'scalar']]#
获取此节点可能产生的所有 nettype 值域,并在首次调用时缓存到类属性中。
- class nd2py.Pow2(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Neg(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Div(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 2#
- class nd2py.Symbol(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
NetTypeMixin,TreeMixin,SymbolAPIMixin- n_operands = None#
- __init__(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Initialize a Symbol node.
This constructor sets the nettype, sanitizes and attaches child operands, and then triggers a nettype inference pass on the whole expression tree.
- Parameters:
*operands – Child operands of this symbol. The number of operands must match
n_operandsof the concrete subclass. Non-symbol scalar values are automatically wrapped asNumbersymbols.nettype (Optional[NetType | Set[NetType]]) – Nettype constraint for this symbol, such as
"node","edge", or"scalar", or a set of allowed nettypes. If provided, it is propagated through the tree byinfer_nettype().
- copy()[source]#
Return a deep copy of this symbol.
The copied symbol has the same tree structure and values as the original but does not share
parentlinks, so it can be safely inserted into a different expression tree.- Returns:
A deep copy of the current symbol.
- Return type:
- get_numbers(fitable_only: bool = False, float_only: bool = False, scalar_only: bool = False) List[Number][source]#
Collect all
Numbernodes contained in this symbol.Traverses the expression tree in preorder and returns all numeric nodes that satisfy the given filters.
- Parameters:
fitable_only (bool, optional) – If True, return only numbers marked as fitable (trainable) parameters. Defaults to False.
float_only (bool, optional) – If True, exclude integer-like values (for example exponents that should remain fixed). Defaults to False.
scalar_only (bool, optional) – If True, only consider scalar numbers (nettype
"scalar"). Defaults to False.
- Returns:
List of numeric symbol nodes that match the filters.
- Return type:
List[Number]
- get_parameters(fitable_only: bool = False, float_only: bool = False) List[float][source]#
Return numeric parameter values contained in this symbol.
This is a convenience wrapper over
get_numbers()that extracts the underlying scalar values fromNumbernodes.- Parameters:
fitable_only (bool, optional) – If True, return only parameters associated with fitable numbers. Defaults to False.
float_only (bool, optional) – If True, exclude integer-like parameters. Defaults to False.
- Returns:
Flat list of parameter values in traversal order.
- Return type:
List[float]
- set_parameters(params: List[float], fitable_only: bool = False, float_only: bool = False)[source]#
Assign new numeric parameter values to this symbol.
The values in
paramsare consumed in the same order as produced byget_parameters()with the same filter options.- Parameters:
params (List[float]) – New parameter values to assign.
fitable_only (bool, optional) – If True, only update fitable parameters and leave others unchanged. Defaults to False.
float_only (bool, optional) – If True, only update non-integer parameters. Defaults to False.
- Raises:
ValueError – If the length of
paramsdoes not match the number of parameters selected by the filters.
- classmethod map_nettype(*children_nettypes: Literal['node', 'edge', 'scalar']) Literal['node', 'edge', 'scalar'] | None[source]#
Default nettype mapping rule for symbol subclasses.
The default behavior enforces that
"node"and"edge"nettypes cannot be mixed. If only scalars are present, the result is"scalar"; otherwise it follows the presence of"node"or"edge".- Parameters:
*children_nettypes (NetType) – Nettypes of the child operands.
- Returns:
Inferred nettype for the parent symbol, or
Noneif the combination is invalid or cannot be determined.- Return type:
Optional[NetType]
- Raises:
ValueError – If the number of child nettypes does not match
cls.n_operands.
- class nd2py.BFGSFit(*args: Any, **kwargs: Any)[source]#
Bases:
BaseEstimator,RegressorMixin
- class nd2py.Variable(name, nettype: Literal['node', 'edge', 'scalar'] = 'scalar')[source]#
Bases:
Symbol- n_operands = 0#
- __init__(name, nettype: Literal['node', 'edge', 'scalar'] = 'scalar')[source]#
Initialize a Symbol node.
This constructor sets the nettype, sanitizes and attaches child operands, and then triggers a nettype inference pass on the whole expression tree.
- Parameters:
*operands – Child operands of this symbol. The number of operands must match
n_operandsof the concrete subclass. Non-symbol scalar values are automatically wrapped asNumbersymbols.nettype (Optional[NetType | Set[NetType]]) – Nettype constraint for this symbol, such as
"node","edge", or"scalar", or a set of allowed nettypes. If provided, it is propagated through the tree byinfer_nettype().
- map_nettype() Literal['node', 'edge', 'scalar'] | None[source]#
Default nettype mapping rule for symbol subclasses.
The default behavior enforces that
"node"and"edge"nettypes cannot be mixed. If only scalars are present, the result is"scalar"; otherwise it follows the presence of"node"or"edge".- Parameters:
*children_nettypes (NetType) – Nettypes of the child operands.
- Returns:
Inferred nettype for the parent symbol, or
Noneif the combination is invalid or cannot be determined.- Return type:
Optional[NetType]
- Raises:
ValueError – If the number of child nettypes does not match
cls.n_operands.
- get_nettype_range() Set[Literal['node', 'edge', 'scalar']][source]#
获取此节点可能产生的所有 nettype 值域,并在首次调用时缓存到类属性中。
- property nettype_range: Set[Literal['node', 'edge', 'scalar']]#
获取此节点可能产生的所有 nettype 值域,并在首次调用时缓存到类属性中。
- class nd2py.Sub(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 2#
- class nd2py.Arcsin(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- nd2py.from_postorder(nodes: List[Symbol | Type[Symbol]], **kwargs) Symbol[source]#
Construct a Symbol tree from a list of Symbols in postorder traversal order.
- class nd2py.Sqrt(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.SqrtAbs(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Log(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Arctan(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Readout(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- classmethod map_nettype(*children_nettypes: Literal['node', 'edge', 'scalar']) Literal['node', 'edge', 'scalar'] | None[source]#
Default nettype mapping rule for symbol subclasses.
The default behavior enforces that
"node"and"edge"nettypes cannot be mixed. If only scalars are present, the result is"scalar"; otherwise it follows the presence of"node"or"edge".- Parameters:
*children_nettypes (NetType) – Nettypes of the child operands.
- Returns:
Inferred nettype for the parent symbol, or
Noneif the combination is invalid or cannot be determined.- Return type:
Optional[NetType]
- Raises:
ValueError – If the number of child nettypes does not match
cls.n_operands.
- class nd2py.Tanh(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Sech(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Max(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 2#
- class nd2py.Tan(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Abs(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Sinh(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Arccos(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.FixNetType[source]#
Bases:
Visitor- generic_visit(node, *args, **kwargs) _Type[source]#
direction = ‘top-down’: 每个 node 的 nettype 由 kwargs[‘nettype’] 决定。 direction = ‘bottom-up’: 每个 node 的 nettype 由其 operands 决定。只保证每个 node 运算不会出错即可,不需要对 kwargs[‘nettype’] 负责
- visit_Add(node, *args, **kwargs) _Type#
- visit_Sub(node, *args, **kwargs) _Type#
- visit_Mul(node, *args, **kwargs) _Type#
- visit_Div(node, *args, **kwargs) _Type#
- visit_Pow(node, *args, **kwargs) _Type#
- visit_Max(node, *args, **kwargs) _Type#
- visit_Min(node, *args, **kwargs) _Type#
- visit_Rgga(node, *args, **kwargs) _Type#
- visit_Targ(node, *args, **kwargs) _Type#
- class nd2py.Sigmoid(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Mul(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 2#
- class nd2py.Pow3(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Exp(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Targ(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Sour
- nd2py.from_preorder(nodes: List[Symbol | Type[Symbol]], **kwargs) Symbol[source]#
Construct a Symbol tree from a list of Symbols in preorder traversal order.
- class nd2py.Sin(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
- class nd2py.Coth(*operands, nettype: Literal['node', 'edge', 'scalar'] | Set[Literal['node', 'edge', 'scalar']] | None = None)[source]#
Bases:
Symbol- n_operands = 1#
Subpackages#
- nd2py.core package
no_copy_value()EmptyaggrCschpow2coslogSplitByMulSourget_copy_value()no_nettype_inference()Cscmaximum()Cotset_fitable()phi_ssinhminregularAddno_set_fitable()LogAbsRggaminimum()SeccoshsigmoidIdentitydivCoshregpowFoldConstantTreePrinterMinConstant()arcsintanhparse()rggamaxpow3addmulnegwarn_once()logabsphi_tsetup_lazy_imports()subInvAggrCosRegularPowset_copy_value()variables()cscNumbertargNumpyCalcNumpyCalc.generic_visit()NumpyCalc.visit_Empty()NumpyCalc.visit_Number()NumpyCalc.visit_Variable()NumpyCalc.visit_Add()NumpyCalc.visit_Sub()NumpyCalc.visit_Mul()NumpyCalc.visit_Div()NumpyCalc.visit_Pow()NumpyCalc.visit_Max()NumpyCalc.visit_Min()NumpyCalc.visit_Identity()NumpyCalc.visit_Sin()NumpyCalc.visit_Cos()NumpyCalc.visit_Tan()NumpyCalc.visit_Sec()NumpyCalc.visit_Csc()NumpyCalc.visit_Cot()NumpyCalc.visit_Log()NumpyCalc.visit_LogAbs()NumpyCalc.visit_Exp()NumpyCalc.visit_Abs()NumpyCalc.visit_Neg()NumpyCalc.visit_Inv()NumpyCalc.visit_Sqrt()NumpyCalc.visit_SqrtAbs()NumpyCalc.visit_Pow2()NumpyCalc.visit_Pow3()NumpyCalc.visit_Arcsin()NumpyCalc.visit_Arccos()NumpyCalc.visit_Arctan()NumpyCalc.visit_Sinh()NumpyCalc.visit_Cosh()NumpyCalc.visit_Tanh()NumpyCalc.visit_Sech()NumpyCalc.visit_Csch()NumpyCalc.visit_Coth()NumpyCalc.visit_Sigmoid()NumpyCalc.visit_Regular()NumpyCalc.visit_Sour()NumpyCalc.visit_Targ()NumpyCalc.visit_Aggr()NumpyCalc.visit_Rgga()NumpyCalc.visit_Readout()
readoutPow2NegDivSymbolBFGSFitVariablearccosSubArcsinprod()from_postorder()SimplifySimplify.generic_visit()Simplify.remove_nested_unary()Simplify.visit_Sin()Simplify.visit_Cos()Simplify.visit_Tanh()Simplify.visit_Sigmoid()Simplify.visit_Sqrt()Simplify.visit_SqrtAbs()Simplify.visit_Exp()Simplify.visit_Log()Simplify.visit_LogAbs()Simplify.visit_Readout()Simplify.visit_Number()Simplify.visit_Variable()Simplify.visit_Add()Simplify.visit_Sub()Simplify.visit_Mul()Simplify.visit_Div()Simplify.visit_Neg()Simplify.visit_Inv()Simplify.visit_Aggr()
Sqrtset_nettype_inference()SqrtAbsLogno_warn()ArctanReadoutTanhcotSechStringPrinterStringPrinter.generic_visit()StringPrinter.visit_Empty()StringPrinter.visit_Number()StringPrinter.visit_Variable()StringPrinter.visit_Add()StringPrinter.visit_Sub()StringPrinter.visit_Mul()StringPrinter.visit_Div()StringPrinter.visit_Pow()StringPrinter.visit_Neg()StringPrinter.visit_Inv()StringPrinter.visit_Pow2()StringPrinter.visit_Pow3()StringPrinter.visit_Sour()StringPrinter.visit_Targ()StringPrinter.visit_Aggr()StringPrinter.visit_Rgga()
nettype_inference()Maxsum()sqrtabsTanAbstanSinhArccosFixNetTypeFixNetType.generic_visit()FixNetType.visit_Number()FixNetType.visit_Variable()FixNetType.visit_BinaryOp()FixNetType.visit_Add()FixNetType.visit_Sub()FixNetType.visit_Mul()FixNetType.visit_Div()FixNetType.visit_Pow()FixNetType.visit_Max()FixNetType.visit_Min()FixNetType.visit_Aggr()FixNetType.visit_Rgga()FixNetType.visit_Sour()FixNetType.visit_Targ()FixNetType.visit_Readout()FixNetType.fix_nettype()FixNetType.edge_to_node()FixNetType.node_to_edge()FixNetType.edge_to_scalar()FixNetType.node_to_scalar()FixNetType.scalar_to_node()FixNetType.scalar_to_edge()
sinsecSigmoidexprhoMulsoursechPow3ExpTarginvfrom_preorder()abssqrtcschSplitByAddSinCotharctan- Subpackages
- Submodules
- nd2py.core.base_visitor module
- nd2py.core.symbol_api module
- nd2py.dataset package
- nd2py.generator package
- nd2py.search package
setup_lazy_imports()- Subpackages
- nd2py.search.e2esr package
- nd2py.search.gp package
- nd2py.search.llmsr package
- nd2py.search.mcts package
- nd2py.search.ndformer package
NDFormerDataGeneratorNDFormerEqtreeGeneratorNDFormerGraphGeneratorNDFormerModelConfigNDFormerTokenizersetup_lazy_imports()- Submodules
- nd2py.search.ndformer.ndformer_config module
- nd2py.search.ndformer.ndformer_dataset module
- nd2py.search.ndformer.ndformer_generator module
- nd2py.search.ndformer.ndformer_mcts module
- nd2py.search.ndformer.ndformer_model module
- nd2py.search.ndformer.ndformer_model_flash_ansr module
- nd2py.search.ndformer.ndformer_tokenizer module
- nd2py.utils package
AttrDictEqualizeNormalizeMAE_score()MAPE_score()NamedTimerNamedTimer.__init__()NamedTimer.add()NamedTimer.clear()NamedTimer.to_str()NamedTimer.namesNamedTimer.timeNamedTimer.countNamedTimer.get_named_time()NamedTimer.get_named_count()NamedTimer.get_named_pace()NamedTimer.get_named_speed()NamedTimer.named_timeNamedTimer.named_countNamedTimer.named_paceNamedTimer.named_speed
ParallelTimerParallelTimer.__init__()ParallelTimer.add()ParallelTimer.clear()ParallelTimer.to_str()ParallelTimer.namesParallelTimer.countParallelTimer.get_named_time()ParallelTimer.get_named_count()ParallelTimer.get_named_pace()ParallelTimer.get_named_speed()ParallelTimer.named_timeParallelTimer.named_countParallelTimer.named_paceParallelTimer.named_speed
R2_score()RMSE_score()Timeradd_minus_flags()add_negation_flags()adjust_text()classpropertyclear_svg()get_fig()init_logger()load_font()log_exception()merge_axes()plotOD()plot_resilience()render_markdown()render_python()sMAPE_score()seed_all()setup_lazy_imports()softmax()tag2ansi()use_chinese_font()- Subpackages
- Submodules
- nd2py.utils.attr_dict module
- nd2py.utils.auto_gpu module
- nd2py.utils.classproperty module
- nd2py.utils.factory module
- nd2py.utils.fix_parser module
- nd2py.utils.lazy_loader module
- nd2py.utils.log_exception module
- nd2py.utils.logger module
- nd2py.utils.metrics module
- nd2py.utils.plot module
- nd2py.utils.render_markdown module
- nd2py.utils.render_python module
- nd2py.utils.tag2ansi module
- nd2py.utils.timing module
TimerNamedTimerNamedTimer.__init__()NamedTimer.add()NamedTimer.clear()NamedTimer.to_str()NamedTimer.namesNamedTimer.timeNamedTimer.countNamedTimer.get_named_time()NamedTimer.get_named_count()NamedTimer.get_named_pace()NamedTimer.get_named_speed()NamedTimer.named_timeNamedTimer.named_countNamedTimer.named_paceNamedTimer.named_speed
ParallelTimerParallelTimer.__init__()ParallelTimer.add()ParallelTimer.clear()ParallelTimer.to_str()ParallelTimer.namesParallelTimer.countParallelTimer.get_named_time()ParallelTimer.get_named_count()ParallelTimer.get_named_pace()ParallelTimer.get_named_speed()ParallelTimer.named_timeParallelTimer.named_countParallelTimer.named_paceParallelTimer.named_speed
- nd2py.utils.utils module