Skip to content
Open
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
2 changes: 1 addition & 1 deletion gridfm_graphkit/datasets/normalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def transform(self, data: HeteroData):
data.edge_attr_dict[("bus", "connects", "bus")][:, ANG_MIN] *= torch.pi / 180.0
data.edge_attr_dict[("bus", "connects", "bus")][:, ANG_MAX] *= torch.pi / 180.0
data.edge_attr_dict[("bus", "connects", "bus")][:, RATE_A] /= self.baseMVA
data.baseMVA = self.baseMVA
data.baseMVA = torch.tensor(self.baseMVA, dtype=torch.float32)
data.is_normalized = True
Comment on lines 230 to 232
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data.baseMVA is changed from a Python scalar to a torch.Tensor. This breaks LoadGridParamsFromPath.forward() (gridfm_graphkit/datasets/transforms.py:114), which assigns data.baseMVA into HeteroDataMVANormalizer.baseMVA; HeteroDataMVANormalizer.transform() then does if self.baseMVA is None or self.baseMVA == 0: and will error when self.baseMVA is a tensor. Consider keeping data.baseMVA as a Python float (or ensuring callers use .item()), and instead cast the scalar used in normalization ops to a float32 tensor on the right device/dtype.

Copilot uses AI. Check for mistakes.

def inverse_transform(self, data: HeteroData):
Expand Down
Loading