Hello,

I am trying to apply the command tf-opt --promote-resources-to-args on the following TF/MLIR code.

func @counter(%arg0: tensor) → tensor {

%1 = “tf.VarHandleOp”() {container = “”, shared_name = “x”} : () → tensor<!tf_type.resource<tensor>>

%2 = “tf.ReadVariableOp”(%1) : (tensor<!tf_type.resource<tensor>>) → tensor

%3 = “tf.Add”(%arg0, %2): (tensor, tensor) → tensor

“tf.AssignVariableOp”(%1, %3) {device = “”} : (tensor<!tf_type.resource<tensor>>, tensor) → ()

%4 = “tf.ReadVariableOp”(%1) : (tensor<!tf_type.resource<tensor>>) → tensor

return %4: tensor

}

It does nothing because the function’s name is not @main. Is there a way to apply this command on every function whatever its name is ?

The result I need is :

func @counter(%arg0: tensor, %arg1: tensor {tf.aliasing_output = 1 : i64, tf.resource_name = “x”}) → (tensor, tensor) {

%0 = “tf.Add”(%arg0, %arg1) : (tensor, tensor) → tensor

return %0, %0 : tensor, tensor

}

Best regards,

HP