Model.drop_singletons()#
- Model.drop_singletons()[source]#
Drops any singleton nodes and variables, i.e. nodes or variables that have neither outputs nor inputs.
- Return type:
Self
Notes
While the
Var.value_nodeandVar.var_value_nodeare no singletons in the node graph, they are still dropped if they belong to a singletonVar.Examples
>>> import liesel.model as lsl >>> x1 = lsl.Var.new_obs(1.0, name="x1") >>> x2 = lsl.Var.new_obs(1.0, name="x2") >>> m = lsl.Model(x1, x2) >>> m.drop_singletons() Model(3 nodes, 0 vars) >>> list(m.vars) []