@@ -259,7 +259,8 @@ private void _check_not_finalized()
259259
260260 public Operation create_op ( string op_type , Tensor [ ] inputs , TF_DataType [ ] dtypes ,
261261 TF_DataType [ ] input_types = null , string name = null ,
262- Dictionary < string , AttrValue > attrs = null , OpDef op_def = null )
262+ Dictionary < string , AttrValue > attrs = null , OpDef op_def = null ,
263+ bool compute_device = true )
263264 {
264265 if ( inputs == null )
265266 inputs = new Tensor [ 0 ] ;
@@ -270,7 +271,7 @@ public Operation create_op(string op_type, Tensor[] inputs, TF_DataType[] dtypes
270271 // If a names ends with a '/' it is a "name scope" and we use it as-is,
271272 // after removing the trailing '/'.
272273 name = name . EndsWith ( "/" ) ? ops . name_from_scope_name ( name ) : unique_name ( name ) ;
273- var node_def = ops . _NodeDef ( op_type , name , device : "" , attrs : attrs ) ;
274+ var node_def = ops . _NodeDef ( op_type , name , attrs : attrs ) ;
274275
275276 var input_ops = inputs . Select ( x => x . op ) . ToArray ( ) ;
276277 var control_inputs = _control_dependencies_for_inputs ( input_ops ) ;
@@ -284,7 +285,7 @@ public Operation create_op(string op_type, Tensor[] inputs, TF_DataType[] dtypes
284285 original_op : null ,
285286 op_def : op_def ) ;
286287
287- _create_op_helper ( op , true ) ;
288+ _create_op_helper ( op , compute_device ) ;
288289
289290 /*Console.Write($"create_op: {op_type} '{node_def.Name}'");
290291 Console.Write($", inputs: {(inputs.Length == 0 ? "empty" : String.Join(", ", inputs.Select(x => x.name)))}");
0 commit comments