MCPcopy Create free account
hub / github.com/M-Nauta/ProtoTree / Node

Class Node

prototree/node.py:6–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class Node(nn.Module):
7
8 def __init__(self, index: int):
9 super().__init__()
10 self._index = index
11
12 def forward(self, *args, **kwargs):
13 raise NotImplementedError
14
15 @property
16 def index(self) -> int:
17 return self._index
18
19 @property
20 def size(self) -> int:
21 raise NotImplementedError
22
23 @property
24 def nodes(self) -> set:
25 return self.branches.union(self.leaves)
26
27 @property
28 def leaves(self) -> set:
29 raise NotImplementedError
30
31 @property
32 def branches(self) -> set:
33 raise NotImplementedError
34
35 @property
36 def nodes_by_index(self) -> dict:
37 raise NotImplementedError
38
39 @property
40 def num_branches(self) -> int:
41 return len(self.branches)
42
43 @property
44 def num_leaves(self) -> int:
45 return len(self.leaves)
46
47 @property
48 def depth(self) -> int:
49 raise NotImplementedError

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected