Skip to content

Commit 7a4eb67

Browse files
Grvzardjames77777778
authored andcommitted
perf: remove a redundant call to Functional.__init__ (keras-team#19805)
1 parent d742b71 commit 7a4eb67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

keras/src/models/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ def call(self, inputs, training=False):
138138
def __new__(cls, *args, **kwargs):
139139
# Signature detection for usage of `Model` as a `Functional`
140140
if functional_init_arguments(args, kwargs) and cls == Model:
141-
from keras.src.models import functional
141+
from keras.src.models.functional import Functional
142142

143-
return functional.Functional(*args, **kwargs)
143+
return Functional.__new__(Functional, *args, **kwargs)
144144
return typing.cast(Model, super().__new__(cls))
145145

146146
def __init__(self, *args, **kwargs):

0 commit comments

Comments
 (0)