Skip to content

Commit

Permalink
update for keras 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PatReis committed Oct 30, 2023
1 parent 9a5555d commit e42fdb0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions kgcnn/layers/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,26 @@ def get_config(self):
config = super(ExpandDims, self).get_config()
config.update({"axis": self.axis})
return config


def Input(
shape=None,
batch_size=None,
dtype=None,
sparse=None,
batch_shape=None,
name=None,
tensor=None,
ragged=None
):

layer = ks.layers.InputLayer(
shape=shape,
batch_size=batch_size,
dtype=dtype,
sparse=sparse,
batch_shape=batch_shape,
name=name,
input_tensor=tensor,
)
return layer.output
3 changes: 2 additions & 1 deletion kgcnn/literature/DMPNN/_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from kgcnn.layers.scale import get as get_scaler
from kgcnn.models.utils import update_model_kwargs
from keras_core.backend import backend as backend_to_use
from kgcnn.layers.modules import Input
from ._model import model_disjoint

# Keep track of model version from commit date in literature.
Expand Down Expand Up @@ -132,7 +133,7 @@ def make_model(name: str = None,
:obj:`keras.models.Model`
"""
# Make input
model_inputs = [ks.layers.Input(**x) for x in inputs]
model_inputs = [Input(**x) for x in inputs]

if input_tensor_type in ["padded", "masked"]:
batched_nodes, batched_edges, batched_indices, batched_reverse, total_nodes, total_edges = model_inputs[:6]
Expand Down

0 comments on commit e42fdb0

Please sign in to comment.