Skip to content

Commit e92aa44

Browse files
committed
rename call to call_fn.
1 parent b02f285 commit e92aa44

23 files changed

Lines changed: 38 additions & 34 deletions
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using NumSharp;
2+
using System;
23
using System.Collections.Generic;
34
using System.Text;
45

@@ -7,5 +8,6 @@ namespace Tensorflow.Keras.ArgsDefinition
78
public class TensorFlowOpLayerArgs : LayerArgs
89
{
910
public NodeDef NodeDef { get; set; }
11+
public Dictionary<int, NDArray> Constants { get; set; }
1012
}
1113
}

src/TensorFlowNET.Core/Keras/BackendImpl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ public Tensor spatial_2d_padding(Tensor x, NDArray padding = null, string data_f
160160
/// </summary>
161161
/// <param name="outputs"></param>
162162
/// <returns></returns>
163-
public Tensor eval_in_eager_or_function(Tensor outputs)
163+
public NDArray eval_in_eager_or_function(Tensor outputs)
164164
{
165-
throw new NotImplementedException("");
165+
return outputs.eval();
166166
}
167167

168168
public class _DummyEagerGraph

src/TensorFlowNET.Core/Keras/Engine/Flatten.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Flatten(FlattenArgs args)
2121
_channels_first = args.DataFormat == "channels_first";
2222
}
2323

24-
protected override Tensors call(Tensors inputs, Tensor state = null, bool is_training = false)
24+
protected override Tensors call_fn(Tensors inputs, Tensor state = null, bool is_training = false)
2525
{
2626
if (_channels_first)
2727
{

src/TensorFlowNET.Core/Keras/Engine/Functional.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,14 @@ void _init_graph_network(Tensors inputs, Tensors outputs)
6969
}
7070
}
7171

72-
protected override Tensors call(Tensors inputs, Tensor state = null, bool is_training = false)
72+
protected override Tensors call_fn(Tensors inputs, Tensor state = null, bool is_training = false)
7373
{
74-
return base.call(inputs, state, is_training);
74+
return run_internal_graph(inputs, state, is_training);
7575
}
7676

77+
Tensors run_internal_graph(Tensors inputs, Tensor state = null, bool is_training = false)
78+
{
79+
throw new NotImplementedException("");
80+
}
7781
}
7882
}

src/TensorFlowNET.Core/Keras/Engine/Layer.Apply.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Tensors Apply(Tensors inputs, Tensor state = null, bool is_training = fal
4646
if (!built)
4747
MaybeBuild(inputs);
4848

49-
outputs = call(inputs, state: state, is_training: is_training);
49+
outputs = call_fn(inputs, state: state, is_training: is_training);
5050

5151
outputs = _set_connectivity_metadata_(inputs, outputs);
5252
_handle_activity_regularization(inputs, outputs);

src/TensorFlowNET.Core/Keras/Engine/Layer.FunctionalConstructionCall.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Tensors FunctionalConstructionCall(Tensors inputs)
4242
if (!dynamic)
4343
throw new NotImplementedException("");
4444

45-
outputs = call(inputs);
45+
outputs = call_fn(inputs);
4646

4747
outputs = _set_connectivity_metadata_(inputs, outputs);
4848
_handle_activity_regularization(inputs, outputs);

src/TensorFlowNET.Core/Keras/Engine/Layer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private Tensor compute_mask(Tensor inputs, Tensor mask = null)
162162
/// <param name="state"></param>
163163
/// <param name="is_training"></param>
164164
/// <returns></returns>
165-
protected virtual Tensors call(Tensors inputs, Tensor state = null, bool is_training = false)
165+
protected virtual Tensors call_fn(Tensors inputs, Tensor state = null, bool is_training = false)
166166
{
167167
throw new NotImplementedException("");
168168
}

src/TensorFlowNET.Core/Keras/Engine/Node.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public Node(Layer layer, NodeArgs args)
5252
layer.InboundNodes.Add(this);
5353
foreach (var kt in kerasInputs)
5454
{
55-
if (kt.KerasHistory == null)
56-
continue;
5755
var inbound_layer = kt.KerasHistory.layer;
5856
if (inbound_layer != null)
5957
inbound_layer.OutboundNodes.Add(this);

src/TensorFlowNET.Core/Keras/Engine/TensorFlowOpLayer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public TensorFlowOpLayer(TensorFlowOpLayerArgs args)
2323
built = true;
2424
}
2525

26-
protected override Tensors call(Tensors inputs, Tensor state = null, bool is_training = false)
26+
protected override Tensors call_fn(Tensors inputs, Tensor state = null, bool is_training = false)
2727
{
28-
return base.call(inputs, state, is_training);
28+
return base.call_fn(inputs, state, is_training);
2929
}
3030
}
3131
}

src/TensorFlowNET.Core/Keras/Layers/BatchNormalization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected override void build(TensorShape input_shape)
119119
built = true;
120120
}
121121

122-
protected override Tensors call(Tensors inputs, Tensor state = null, bool is_training = false)
122+
protected override Tensors call_fn(Tensors inputs, Tensor state = null, bool is_training = false)
123123
{
124124
Tensor outputs = null;
125125

0 commit comments

Comments
 (0)