Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions bittensor/metagraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ def sync(
block: Optional[int] = None,
lite: bool = True,
subtensor: Optional["bittensor.subtensor"] = None,
root: bool = False,
) -> "metagraph":
"""
Initiates the synchronization process of the metagraph.
Expand All @@ -364,7 +363,7 @@ def sync(

# If not a 'lite' version, compute and set weights and bonds for each neuron
if not lite:
self._set_weights_and_bonds(root=root, subtensor=subtensor)
self._set_weights_and_bonds(subtensor=subtensor)

def _initialize_subtensor(self, subtensor):
"""
Expand Down Expand Up @@ -474,17 +473,15 @@ def _create_tensor(self, data, dtype) -> torch.nn.Parameter:
# TODO: Check and test the creation of tensor
return torch.nn.Parameter(torch.tensor(data, dtype=dtype), requires_grad=False)

def _set_weights_and_bonds(
self, root: bool = False, subtensor: bittensor.subtensor = None
):
def _set_weights_and_bonds(self, subtensor: bittensor.subtensor = None):
"""
Computes and sets weights and bonds for each neuron.

Returns:
None.
"""
# TODO: Check and test the computation of weights and bonds
if root:
if self.netuid == 0: # Is this the root network?
self.weights = self._process_root_weights(
[neuron.weights for neuron in self.neurons], "weights", subtensor
)
Expand Down
3 changes: 1 addition & 2 deletions bittensor/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2310,7 +2310,6 @@ def metagraph(
netuid: int,
lite: bool = True,
block: Optional[int] = None,
root: bool = False,
) -> "bittensor.Metagraph":
r"""Returns a synced metagraph for the subnet.
Args:
Expand All @@ -2327,7 +2326,7 @@ def metagraph(
metagraph_ = bittensor.metagraph(
network=self.network, netuid=netuid, lite=lite, sync=False
)
metagraph_.sync(block=block, lite=lite, subtensor=self, root=root)
metagraph_.sync(block=block, lite=lite, subtensor=self)

return metagraph_

Expand Down