Skip to content

Public API Refactor - #382

Merged
Jacob-Chmura merged 41 commits into
mainfrom
dev/dgbatch_api_refactor
Jan 15, 2026
Merged

Public API Refactor#382
Jacob-Chmura merged 41 commits into
mainfrom
dev/dgbatch_api_refactor

Conversation

@Jacob-Chmura

@Jacob-Chmura Jacob-Chmura commented Jan 12, 2026

Copy link
Copy Markdown
Member

Close #377

@Jacob-Chmura Jacob-Chmura self-assigned this Jan 12, 2026
@Jacob-Chmura
Jacob-Chmura changed the base branch from main to dev/dgraph_api_refactor January 12, 2026 17:33
Base automatically changed from dev/dgraph_api_refactor to main January 13, 2026 20:29
@Jacob-Chmura
Jacob-Chmura requested a review from ntgbaoo January 13, 2026 20:37

@ntgbaoo ntgbaoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are a few parts of some docs that need to be updated. Other than that, looks good to me.
quickstart.md need to be updated as well.

Comment thread docs/tutorials/dgraph_tutorial.md
Comment thread README.md
@Jacob-Chmura
Jacob-Chmura marked this pull request as ready for review January 14, 2026 17:05
@Jacob-Chmura Jacob-Chmura changed the title DGBatch api refactor Public API Refactor Jan 14, 2026
@tgm-team tgm-team deleted a comment from codecov Bot Jan 14, 2026
@codecov

codecov Bot commented Jan 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.54751% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tgm/data/split.py 90.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread examples/linkproppred/base3.py Outdated
Comment thread docs/tutorials/dgraph_tutorial.md
Comment thread docs/tutorials/dgraph_tutorial.md
Comment thread docs/tutorials/hook_tutorial.md
Comment thread examples/linkproppred/tpnet.py
for batch in tqdm(loader):
opt.zero_grad()
y_true = batch.dynamic_node_feats
y_true = batch.node_x

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in the label PR, this becomes node_y

Comment thread tgm/core/_storage/backends/array_backend.py Outdated
Comment thread tgm/data/dg_data.py
num_nodes = torch.max(self.edge_index).item() + 1 # 0-indexed
if self.node_ids is not None:
num_nodes = max(num_nodes, torch.max(self.node_ids).item() + 1) # 0-indexed
if self.node_x_nids is not None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

interestingly for node_y_nids in next PR, what if max_node exist in node_y what would that mean?
to me it would just be invalid? you are predicting for an unknown node, it should be invalid

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure about that. Seems like something that could easily happen?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if the node doesn't exist in the graph then you can't predict for it? to discuss in next PR

@ntgbaoo ntgbaoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Jacob-Chmura for a very comprehensive PR. Took me a while to go over it lol.

Comment thread tgm/data/dg_data.py Outdated
Comment thread tgm/data/dg_data.py Outdated
Comment thread tgm/core/graph.py
return edge_type

@_logged_cached_property
def _node_events_cpu(self) -> Tuple[Tensor, Tensor]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
def _node_events_cpu(self) -> Tuple[Tensor, Tensor]:
def _node_x_cpu(self) -> Tuple[Tensor, Tensor]:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think this conflicts too much with the backend call get_node_x which is getting dynamic node features

Comment thread tgm/core/graph.py

@_logged_cached_property
def _node_events_cpu(self) -> Tuple[Tensor, Tensor]:
return self._storage.get_node_events(self._slice)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we want to change implementation of storage to get_node_x? Eventually, I think we should since there will be get_node_y

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hmm, I'll consider in the subsequent label PR. My only concern is that we already have get_node_x as the backend method to get dynamic node features.

Arguably we can consolidate these all somehow.

@@ -70,12 +70,12 @@ def get_edges(self, slice: DGSliceTracker) -> Tuple[Tensor, Tensor, Tensor]:
def get_node_events(self, slice: DGSliceTracker) -> Tuple[Tensor, Tensor]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
def get_node_events(self, slice: DGSliceTracker) -> Tuple[Tensor, Tensor]:
def get_node_x(self, slice: DGSliceTracker) -> Tuple[Tensor, Tensor]:

Comment thread tgm/hooks/hook_manager.py
Comment thread docs/quickstart.md
Comment thread README.md

@ntgbaoo ntgbaoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

@Jacob-Chmura
Jacob-Chmura merged commit fbffd69 into main Jan 15, 2026
7 checks passed
@Jacob-Chmura
Jacob-Chmura deleted the dev/dgbatch_api_refactor branch January 15, 2026 18:17

@shenyangHuang shenyangHuang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shorter and Simpler Names across public api

3 participants