Skip to content

Commit 601c423

Browse files
committed
fix attrs missing.
1 parent 2efaaa8 commit 601c423

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public Tensor[] TFE_FastPathExecute(Context ctx,
5050

5151
var op_def = tf.get_default_graph().GetOpDef(opName);
5252

53+
var flattened_attrs = new List<object>(op_def.InputArg.Count);
54+
var flattened_inputs = new List<Tensor>(op_def.InputArg.Count);
55+
5356
// Set non-inferred attrs, including setting defaults if the attr is passed in
5457
// as None.
5558
for (int i = kFastPathExecuteInputStartIndex + op_def.InputArg.Count; i < args_size; i += 2)
@@ -60,14 +63,14 @@ public Tensor[] TFE_FastPathExecute(Context ctx,
6063
var attr = op_def.Attr.FirstOrDefault(x => x.Name == attr_name);
6164
if(attr != null)
6265
{
66+
flattened_attrs.Add(attr_name);
67+
flattened_attrs.Add(attr_value);
68+
6369
SetOpAttrWithDefaults(ctx, op, attr, attr_name, attr_value, attr_list_sizes, status);
6470
status.Check(true);
6571
}
6672
}
6773

68-
var flattened_attrs = new List<object>(op_def.InputArg.Count);
69-
var flattened_inputs = new List<Tensor>(op_def.InputArg.Count);
70-
7174
c_api.TFE_OpSetDevice(op, device_name, status.Handle);
7275
status.Check(true);
7376

@@ -229,6 +232,7 @@ bool AddInputToOp(object inputs,
229232
default:
230233
var tensor = tf.convert_to_tensor(inputs);
231234
input_handle = tensor.EagerTensorHandle;
235+
flattened_inputs.Add(tensor);
232236
break;
233237
}
234238

0 commit comments

Comments
 (0)