Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I transform 6 separate graph tensor into a single tf.data.Dataset and batch it? #805

Open
cherryCookies opened this issue May 27, 2024 · 0 comments

Comments

@cherryCookies
Copy link

cherryCookies commented May 27, 2024

To whom it may concern,

Before I get into the issue, please bear with me if I get lost since I am a novice in the field of graph neural network, and I am on my own.
I am struggling with transforming 6 separate graph tensor into a single dataset of a 6 batches.
The graph schema for each heterogenous graph is identical, and they consist of one node sets and two edge sets. (Sorry for not being able to share the exact schema because it is a part of a research)

스크린샷 2024-05-27 오후 2 49 05

Now I would like to transform 6 graph tensor into a dataset with 6 batches.
So, I have done following code to merge graph tensors into one single Datasets, so that I can perform Datasets.batch()

Graph tensor into tf.data.Dataset

dataset_l = []
for i in range(6):
dataset = eachGraphTensor.map(lambda serialized:tfgnn.parse_single_example(input_spec, serialized))
dataset_l.append(dataset)

Merging tf.data.Dataset

dataset_l = [6 graph tensor in a list]
mergedDataset = dataset_l[0]
for i in range(1,len(dataset_l)):
mergedDataset.concatenate(dataset_l[i])

Batching

dataset = mergedDataset.batch(1)

Is this acceptable way to merge individual graph tensor into a single dataset and batching it?

Kind Regards
Charyeong Heo from Seoul, Korea

@cherryCookies cherryCookies changed the title How can I transform 6 separate graph tensor into a dataset as a batch? How can I transform 6 separate graph tensor into a single tf.data.Dataset and batch it? May 27, 2024
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

No branches or pull requests

1 participant