-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
UnravelSports [JB]
committed
Jan 30, 2025
1 parent
7c8fc7e
commit 822d1d7
Showing
7 changed files
with
258 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from spektral.data import DisjointLoader | ||
import tensorflow as tf | ||
|
||
version = tf.__version__.split(".") | ||
major, minor = int(version[0]), int(version[1]) | ||
tf_loader_available = major >= 2 and minor >= 4 | ||
|
||
|
||
class CustomDisjointLoader(DisjointLoader): | ||
def __init__( | ||
self, dataset, node_level=False, batch_size=1, epochs=None, shuffle=True | ||
): | ||
self.node_level = node_level | ||
super().__init__(dataset, batch_size=batch_size, epochs=epochs, shuffle=shuffle) | ||
|
||
def load(self): | ||
if not tf_loader_available: | ||
raise RuntimeError( | ||
"Calling DisjointLoader.load() requires TensorFlow 2.4 or greater." | ||
) | ||
dataset = tf.data.Dataset.from_generator( | ||
lambda: self, output_signature=self.tf_signature() | ||
) | ||
dataset = dataset.shuffle(buffer_size=1000) | ||
return dataset.repeat() |
Oops, something went wrong.