wdf.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:vadouvan 作者: vadouvan 项目源码 文件源码
def __init__(
            self,
            root,
            outputs,
            inputs=None,
            name="unnamed_tree",
            ):
        self.root = copy.deepcopy(root)
        if not self.root.prototype.get("root"):
            raise vadouvan.exceptions.WDFError(
                "Attempted to use non-root node type '{}' as root of a "
                "WDFTree."
                .format(self.root.prototype["name"]))

        self.name = name

        if isinstance(outputs, numbers.Number):
            outputs = sympy.sympify(outputs)
        if isinstance(outputs, sympy.Expr):
            outputs = [("out", outputs)]
        self.outputs = collections.OrderedDict(outputs)

        actual_inputs_set = self._normalize_parameters_and_get_inputs()
        if inputs is None:
            self.inputs = sorted(list(actual_inputs_set))
        else:
            if set(inputs) != actual_inputs_set:
                raise vadouvan.exceptions.WDFError(
                    "Discrepancy between provided inputs list and tree"
                    " inputs.")
            self.inputs = inputs

        self._assign_names_to_unnamed_nodes()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号