@@ -26,26 +26,27 @@ Tensors FunctionalConstructionCall(Tensors inputs)
2626 var graph = keras . backend . get_graph ( ) ;
2727 graph . as_default ( ) ;
2828
29- tf_with ( ops . name_scope ( _name_scope ( ) ) , scope =>
30- {
31- MaybeBuild ( inputs ) ;
32-
33- // Wrapping `call` function in autograph to allow for dynamic control
34- // flow and control dependencies in call. We are limiting this to
35- // subclassed layers as autograph is strictly needed only for
36- // subclassed layers and models.
37- // tf_convert will respect the value of autograph setting in the
38- // enclosing tf.function, if any.
39- if ( ! dynamic )
40- throw new NotImplementedException ( "" ) ;
41-
42- outputs = Call ( inputs ) ;
29+ var scope = ops . name_scope ( _name_scope ( ) ) ;
30+ scope . __enter__ ( ) ;
31+
32+ MaybeBuild ( inputs ) ;
33+
34+ // Wrapping `call` function in autograph to allow for dynamic control
35+ // flow and control dependencies in call. We are limiting this to
36+ // subclassed layers as autograph is strictly needed only for
37+ // subclassed layers and models.
38+ // tf_convert will respect the value of autograph setting in the
39+ // enclosing tf.function, if any.
40+ if ( ! dynamic )
41+ throw new NotImplementedException ( "" ) ;
42+
43+ outputs = Call ( inputs ) ;
4344
44- _set_connectivity_metadata_ ( inputs , outputs ) ;
45- _handle_activity_regularization ( inputs , outputs ) ;
46- _set_mask_metadata ( inputs , outputs , null ) ;
47- } ) ;
45+ _set_connectivity_metadata_ ( inputs , outputs ) ;
46+ _handle_activity_regularization ( inputs , outputs ) ;
47+ _set_mask_metadata ( inputs , outputs , null ) ;
4848
49+ scope . __exit__ ( ) ;
4950 graph . Exit ( ) ;
5051
5152 return outputs ;
0 commit comments