Tensorflow Model to MLIR

368 views
Skip to first unread message

Aruna Kote

unread,
Sep 14, 2020, 7:00:36 PM9/14/20
to MLIR

Hello,

I want convert tensorflow model to MLIR .

I saved tensorflow model using model.save() as saved_model.pb.

How can lower the convert model to MLIR (affine/std dialect)?
What are the steps to do so?

Thank You

Uday Bondhugula

unread,
Sep 15, 2020, 2:59:11 AM9/15/20
to MLIR, aruna...@gmail.com

Aruna Kote

unread,
Aug 9, 2021, 10:57:58 AM8/9/21
to MLIR, Uday Bondhugula, Aruna Kote
Hi,
    I saved tf model with signature as  predict and I used tf-mlir-translate --savedmodel-objectgraph-to-mlir --tf-savedmodel-exported-names=saved_model /data/aruna/tf_models -o tf_executor.mlir   and then I tired to convert it to HLO using tf-opt -tf-executor-island-coarsening -canonicalize --tf-device-decompose-resource-ops-in-cluster -tf-promote-resources-to-args  --tf-promote-var-handles-to-args --tf-readonly-references-to-resources --tf-resource-device-inference --tf-resource-op-lifting-for-main-function --tf-parallel-execute-to-islands -canonicalize --xla-legalize-tf  tf_executor.mlir >sample.mlir

But I am getting error as :
error: The following operations cannot be legalized: tf.ReadVariableOp (count: 320). These legalization failure(s) may be due to missing TF to HLO lowerings and/or unsupported attributes, etc.
  func private @__inference__wrapped_model_74180(%arg0: tensor<?x224x224x3xf32> {tf._user_specified_name = "input_1"}, %arg1: tensor<!tf.resource>, %arg2: tensor<!tf.resource>, %arg3: tensor<!tf.resource>, %arg4: tensor<!tf.resource>, %arg5: tensor<!tf.resource>, %arg6: tensor<!tf.resource>, %arg7: tensor<!tf.resource>, %arg8: tensor<!tf.resource>, %arg9: tensor<!tf.resource>, %arg10: tensor<!tf.resource>, %arg11: tensor<!tf.resource>, %arg12: tensor<!tf.resource>, %arg13: tensor<!tf.resource>, %arg14: tensor<!tf.resource>, %arg15: tensor<!tf.resource>, %arg16: tensor<!tf.resource>, %arg17: tensor<!tf.resource>, %arg18: tensor<!tf.resource>, %arg19: tensor<!tf.resource>, %arg20: tensor<!tf.resource>, %arg21: tensor<!tf.resource>, %arg22: tensor<!tf.resource>, %arg23: tensor<!tf.resource>, %arg24: tensor<!tf.resource>, %arg25: tensor<!tf.resource>, %arg26: tensor<!tf.resource>, %arg27: tensor<!tf.resource>, %arg28: tensor<!tf.resource>, %arg29: tensor<!tf.resource>, %arg30: tensor<!tf.resource>, %arg31: tensor<!tf.resource>, %arg32: tensor<!tf.resource>, %arg33: tensor<!tf.resource>, %arg34: tensor<!tf.resource>, %arg35: tensor<!tf.resource>, %arg36: tensor<!tf.resource>, %arg37: tensor<!tf.resource>, %arg38: tensor<!tf.resource>, %arg39: tensor<!tf.resource>, %arg40: tensor<!tf.resource>, %arg41: tensor<!tf.resource>, %arg42: tensor<!tf.resource>, %arg43: tensor<!tf.resource>, %arg44: tensor<!tf.resource>, %arg45: tensor<!tf.resource>, %arg46: tensor<!tf.resource>, %arg47: tensor<!tf.resource>, %arg48: tensor<!tf.resource>, %arg49: tensor<!tf.resource>, %arg50: tensor<!tf.resource>, %arg51: tensor<!tf.resource>, %arg52: tensor<!tf.resource>, %arg53: tensor<!tf.resource>, %arg54: tensor<!tf.resource>, %arg55: tensor<!tf.resource>, %arg56: tensor<!tf.resource>, %arg57: tensor<!tf.resource>, %arg58: tensor<!tf.resource>, %arg59: tensor<!tf.resource>, %arg60: tensor<!tf.resource>, %arg61: tensor<!tf.resource>, %arg62: tensor<!tf.resource>, %arg63: tensor<!tf.resource>, %arg64: tensor<!tf.resource>, %arg65: tensor<!tf.resource>, %arg66: tensor<!tf.resource>, %arg67: tensor<!tf.resource>, %arg68: tensor<!tf.resource>, %arg69: tensor<!tf.resource>, %arg70: tensor<!tf.resource>, %arg71: tensor<!tf.resource>, %arg72: tensor<!tf.resource>, %arg73: tensor<!tf.resource>, %arg74: tensor<!tf.resource>, %arg75: tensor<!tf.resource>, %arg76: tensor<!tf.resource>, %arg77: tensor<!tf.resource>, %arg78: tensor<!tf.resource>, %arg79: tensor<!tf.resource>, %arg80: tensor<!tf.resource>, %arg81: tensor<!tf.resource>, %arg82: tensor<!tf.resource>, %arg83: tensor<!tf.resource>, %arg84: tensor<!tf.resource>, %arg85: tensor<!tf.resource>, %arg86: tensor<!tf.resource>, %arg87: tensor<!tf.resource>, %arg88: tensor<!tf.resource>, %arg89: tensor<!tf.resource>, %arg90: tensor<!tf.resource>, %arg91: tensor<!tf.resource>, %arg92: tensor<!tf.resource>, %arg93: tensor<!tf.resource>, %arg94: tensor<!tf.resource>, %arg95: tensor<!tf.resource>, %arg96: tensor<!tf.resource>, %arg97: tensor<!tf.resource>, %arg98: tensor<!tf.resource>, %arg99: tensor<!tf.resource>, %arg100: tensor<!tf.resource>, %arg101: tensor<!tf.resource>, %arg102: tensor<!tf.resource>, %arg103: tensor<!tf.resource>, %arg104: tensor<!tf.resource>, %arg105: tensor<!tf.resource>, %arg106: tensor<!tf.resource>, %arg107: tensor<!tf.resource>, %arg108: tensor<!tf.resource>, %arg109: tensor<!tf.resource>, %arg110: tensor<!tf.resource>, %arg111: tensor<!tf.resource>, %arg112: tensor<!tf.resource>, %arg113: tensor<!tf.resource>, %arg114: tensor<!tf.resource>, %arg115: tensor<!tf.resource>, %arg116: tensor<!tf.resource>, %arg117: tensor<!tf.resource>, %arg118: tensor<!tf.resource>, %arg119: tensor<!tf.resource>, %arg120: tensor<!tf.resource>, %arg121: tensor<!tf.resource>, %arg122: tensor<!tf.resource>, %arg123: tensor<!tf.resource>, %arg124: tensor<!tf.resource>, %arg125: tensor<!tf.resource>, %arg126: tensor<!tf.resource>, %arg127: tensor<!tf.resource>, %arg128: tensor<!tf.resource>, %arg129: tensor<!tf.resource>, %arg130: tensor<!tf.resource>, %arg131: tensor<!tf.resource>, %arg132: tensor<!tf.resource>, %arg133: tensor<!tf.resource>, %arg134: tensor<!tf.resource>, %arg135: tensor<!tf.resource>, %arg136: tensor<!tf.resource>, %arg137: tensor<!tf.resource>, %arg138: tensor<!tf.resource>, %arg139: tensor<!tf.resource>, %arg140: tensor<!tf.resource>, %arg141: tensor<!tf.resource>, %arg142: tensor<!tf.resource>, %arg143: tensor<!tf.resource>, %arg144: tensor<!tf.resource>, %arg145: tensor<!tf.resource>, %arg146: tensor<!tf.resource>, %arg147: tensor<!tf.resource>, %arg148: tensor<!tf.resource>, %arg149: tensor<!tf.resource>, %arg150: tensor<!tf.resource>, %arg151: tensor<!tf.resource>, %arg152: tensor<!tf.resource>, %arg153: tensor<!tf.resource>, %arg154: tensor<!tf.resource>, %arg155: tensor<!tf.resource>, %arg156: tensor<!tf.resource>, %arg157: tensor<!tf.resource>, %arg158: tensor<!tf.resource>, %arg159: tensor<!tf.resource>, %arg160: tensor<!tf.resource>, %arg161: tensor<!tf.resource>, %arg162: tensor<!tf.resource>, %arg163: tensor<!tf.resource>, %arg164: tensor<!tf.resource>, %arg165: tensor<!tf.resource>, %arg166: tensor<!tf.resource>, %arg167: tensor<!tf.resource>, %arg168: tensor<!tf.resource>, %arg169: tensor<!tf.resource>, %arg170: tensor<!tf.resource>, %arg171: tensor<!tf.resource>, %arg172: tensor<!tf.resource>, %arg173: tensor<!tf.resource>, %arg174: tensor<!tf.resource>, %arg175: tensor<!tf.resource>, %arg176: tensor<!tf.resource>, %arg177: tensor<!tf.resource>, %arg178: tensor<!tf.resource>, %arg179: tensor<!tf.resource>, %arg180: tensor<!tf.resource>, %arg181: tensor<!tf.resource>, %arg182: tensor<!tf.resource>, %arg183: tensor<!tf.resource>, %arg184: tensor<!tf.resource>, %arg185: tensor<!tf.resource>, %arg186: tensor<!tf.resource>, %arg187: tensor<!tf.resource>, %arg188: tensor<!tf.resource>, %arg189: tensor<!tf.resource>, %arg190: tensor<!tf.resource>, %arg191: tensor<!tf.resource>, %arg192: tensor<!tf.resource>, %arg193: tensor<!tf.resource>, %arg194: tensor<!tf.resource>, %arg195: tensor<!tf.resource>, %arg196: tensor<!tf.resource>, %arg197: tensor<!tf.resource>, %arg198: tensor<!tf.resource>, %arg199: tensor<!tf.resource>, %arg200: tensor<!tf.resource>, %arg201: tensor<!tf.resource>, %arg202: tensor<!tf.resource>, %arg203: tensor<!tf.resource>, %arg204: tensor<!tf.resource>, %arg205: tensor<!tf.resource>, %arg206: tensor<!tf.resource>, %arg207: tensor<!tf.resource>, %arg208: tensor<!tf.resource>, %arg209: tensor<!tf.resource>, %arg210: tensor<!tf.resource>, %arg211: tensor<!tf.resource>, %arg212: tensor<!tf.resource>, %arg213: tensor<!tf.resource>, %arg214: tensor<!tf.resource>, %arg215: tensor<!tf.resource>, %arg216: tensor<!tf.resource>, %arg217: tensor<!tf.resource>, %arg218: tensor<!tf.resource>, %arg219: tensor<!tf.resource>, %arg220: tensor<!tf.resource>, %arg221: tensor<!tf.resource>, %arg222: tensor<!tf.resource>, %arg223: tensor<!tf.resource>, %arg224: tensor<!tf.resource>, %arg225: tensor<!tf.resource>, %arg226: tensor<!tf.resource>, %arg227: tensor<!tf.resource>, %arg228: tensor<!tf.resource>, %arg229: tensor<!tf.resource>, %arg230: tensor<!tf.resource>, %arg231: tensor<!tf.resource>, %arg232: tensor<!tf.resource>, %arg233: tensor<!tf.resource>, %arg234: tensor<!tf.resource>, %arg235: tensor<!tf.resource>, %arg236: tensor<!tf.resource>, %arg237: tensor<!tf.resource>, %arg238: tensor<!tf.resource>, %arg239: tensor<!tf.resource>, %arg240: tensor<!tf.resource>, %arg241: tensor<!tf.resource>, %arg242: tensor<!tf.resource>, %arg243: tensor<!tf.resource>, %arg244: tensor<!tf.resource>, %arg245: tensor<!tf.resource>, %arg246: tensor<!tf.resource>, %arg247: tensor<!tf.resource>, %arg248: tensor<!tf.resource>, %arg249: tensor<!tf.resource>, %arg250: tensor<!tf.resource>, %arg251: tensor<!tf.resource>, %arg252: tensor<!tf.resource>, %arg253: tensor<!tf.resource>, %arg254: tensor<!tf.resource>, %arg255: tensor<!tf.resource>, %arg256: tensor<!tf.resource>, %arg257: tensor<!tf.resource>, %arg258: tensor<!tf.resource>, %arg259: tensor<!tf.resource>, %arg260: tensor<!tf.resource>, %arg261: tensor<!tf.resource>, %arg262: tensor<!tf.resource>, %arg263: tensor<!tf.resource>, %arg264: tensor<!tf.resource>, %arg265: tensor<!tf.resource>, %arg266: tensor<!tf.resource>, %arg267: tensor<!tf.resource>, %arg268: tensor<!tf.resource>, %arg269: tensor<!tf.resource>, %arg270: tensor<!tf.resource>, %arg271: tensor<!tf.resource>, %arg272: tensor<!tf.resource>, %arg273: tensor<!tf.resource>, %arg274: tensor<!tf.resource>, %arg275: tensor<!tf.resource>, %arg276: tensor<!tf.resource>, %arg277: tensor<!tf.resource>, %arg278: tensor<!tf.resource>, %arg279: tensor<!tf.resource>, %arg280: tensor<!tf.resource>, %arg281: tensor<!tf.resource>, %arg282: tensor<!tf.resource>, %arg283: tensor<!tf.resource>, %arg284: tensor<!tf.resource>, %arg285: tensor<!tf.resource>, %arg286: tensor<!tf.resource>, %arg287: tensor<!tf.resource>, %arg288: tensor<!tf.resource>, %arg289: tensor<!tf.resource>, %arg290: tensor<!tf.resource>, %arg291: tensor<!tf.resource>, %arg292: tensor<!tf.resource>, %arg293: tensor<!tf.resource>, %arg294: tensor<!tf.resource>, %arg295: tensor<!tf.resource>, %arg296: tensor<!tf.resource>, %arg297: tensor<!tf.resource>, %arg298: tensor<!tf.resource>, %arg299: tensor<!tf.resource>, %arg300: tensor<!tf.resource>, %arg301: tensor<!tf.resource>, %arg302: tensor<!tf.resource>, %arg303: tensor<!tf.resource>, %arg304: tensor<!tf.resource>, %arg305: tensor<!tf.resource>, %arg306: tensor<!tf.resource>, %arg307: tensor<!tf.resource>, %arg308: tensor<!tf.resource>, %arg309: tensor<!tf.resource>, %arg310: tensor<!tf.resource>, %arg311: tensor<!tf.resource>, %arg312: tensor<!tf.resource>, %arg313: tensor<!tf.resource>, %arg314: tensor<!tf.resource>, %arg315: tensor<!tf.resource>, %arg316: tensor<!tf.resource>, %arg317: tensor<!tf.resource>, %arg318: tensor<!tf.resource>, %arg319: tensor<!tf.resource>, %arg320: tensor<!tf.resource>) -> tensor<?x1000xf32> attributes {tf._construction_context = "kEagerRuntime", tf._input_shapes = [#tf.shape<?x224x224x3>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>], tf.signature.is_stateful} {
  ^
tf_executor.mlir:322:3: error: Emitting more detail about one op that failed to legalize...
  func private @__inference__wrapped_model_74180(%arg0: tensor<?x224x224x3xf32> {tf._user_specified_name = "input_1"}, %arg1: tensor<!tf.resource>, %arg2: tensor<!tf.resource>, %arg3: tensor<!tf.resource>, %arg4: tensor<!tf.resource>, %arg5: tensor<!tf.resource>, %arg6: tensor<!tf.resource>, %arg7: tensor<!tf.resource>, %arg8: tensor<!tf.resource>, %arg9: tensor<!tf.resource>, %arg10: tensor<!tf.resource>, %arg11: tensor<!tf.resource>, %arg12: tensor<!tf.resource>, %arg13: tensor<!tf.resource>, %arg14: tensor<!tf.resource>, %arg15: tensor<!tf.resource>, %arg16: tensor<!tf.resource>, %arg17: tensor<!tf.resource>, %arg18: tensor<!tf.resource>, %arg19: tensor<!tf.resource>, %arg20: tensor<!tf.resource>, %arg21: tensor<!tf.resource>, %arg22: tensor<!tf.resource>, %arg23: tensor<!tf.resource>, %arg24: tensor<!tf.resource>, %arg25: tensor<!tf.resource>, %arg26: tensor<!tf.resource>, %arg27: tensor<!tf.resource>, %arg28: tensor<!tf.resource>, %arg29: tensor<!tf.resource>, %arg30: tensor<!tf.resource>, %arg31: tensor<!tf.resource>, %arg32: tensor<!tf.resource>, %arg33: tensor<!tf.resource>, %arg34: tensor<!tf.resource>, %arg35: tensor<!tf.resource>, %arg36: tensor<!tf.resource>, %arg37: tensor<!tf.resource>, %arg38: tensor<!tf.resource>, %arg39: tensor<!tf.resource>, %arg40: tensor<!tf.resource>, %arg41: tensor<!tf.resource>, %arg42: tensor<!tf.resource>, %arg43: tensor<!tf.resource>, %arg44: tensor<!tf.resource>, %arg45: tensor<!tf.resource>, %arg46: tensor<!tf.resource>, %arg47: tensor<!tf.resource>, %arg48: tensor<!tf.resource>, %arg49: tensor<!tf.resource>, %arg50: tensor<!tf.resource>, %arg51: tensor<!tf.resource>, %arg52: tensor<!tf.resource>, %arg53: tensor<!tf.resource>, %arg54: tensor<!tf.resource>, %arg55: tensor<!tf.resource>, %arg56: tensor<!tf.resource>, %arg57: tensor<!tf.resource>, %arg58: tensor<!tf.resource>, %arg59: tensor<!tf.resource>, %arg60: tensor<!tf.resource>, %arg61: tensor<!tf.resource>, %arg62: tensor<!tf.resource>, %arg63: tensor<!tf.resource>, %arg64: tensor<!tf.resource>, %arg65: tensor<!tf.resource>, %arg66: tensor<!tf.resource>, %arg67: tensor<!tf.resource>, %arg68: tensor<!tf.resource>, %arg69: tensor<!tf.resource>, %arg70: tensor<!tf.resource>, %arg71: tensor<!tf.resource>, %arg72: tensor<!tf.resource>, %arg73: tensor<!tf.resource>, %arg74: tensor<!tf.resource>, %arg75: tensor<!tf.resource>, %arg76: tensor<!tf.resource>, %arg77: tensor<!tf.resource>, %arg78: tensor<!tf.resource>, %arg79: tensor<!tf.resource>, %arg80: tensor<!tf.resource>, %arg81: tensor<!tf.resource>, %arg82: tensor<!tf.resource>, %arg83: tensor<!tf.resource>, %arg84: tensor<!tf.resource>, %arg85: tensor<!tf.resource>, %arg86: tensor<!tf.resource>, %arg87: tensor<!tf.resource>, %arg88: tensor<!tf.resource>, %arg89: tensor<!tf.resource>, %arg90: tensor<!tf.resource>, %arg91: tensor<!tf.resource>, %arg92: tensor<!tf.resource>, %arg93: tensor<!tf.resource>, %arg94: tensor<!tf.resource>, %arg95: tensor<!tf.resource>, %arg96: tensor<!tf.resource>, %arg97: tensor<!tf.resource>, %arg98: tensor<!tf.resource>, %arg99: tensor<!tf.resource>, %arg100: tensor<!tf.resource>, %arg101: tensor<!tf.resource>, %arg102: tensor<!tf.resource>, %arg103: tensor<!tf.resource>, %arg104: tensor<!tf.resource>, %arg105: tensor<!tf.resource>, %arg106: tensor<!tf.resource>, %arg107: tensor<!tf.resource>, %arg108: tensor<!tf.resource>, %arg109: tensor<!tf.resource>, %arg110: tensor<!tf.resource>, %arg111: tensor<!tf.resource>, %arg112: tensor<!tf.resource>, %arg113: tensor<!tf.resource>, %arg114: tensor<!tf.resource>, %arg115: tensor<!tf.resource>, %arg116: tensor<!tf.resource>, %arg117: tensor<!tf.resource>, %arg118: tensor<!tf.resource>, %arg119: tensor<!tf.resource>, %arg120: tensor<!tf.resource>, %arg121: tensor<!tf.resource>, %arg122: tensor<!tf.resource>, %arg123: tensor<!tf.resource>, %arg124: tensor<!tf.resource>, %arg125: tensor<!tf.resource>, %arg126: tensor<!tf.resource>, %arg127: tensor<!tf.resource>, %arg128: tensor<!tf.resource>, %arg129: tensor<!tf.resource>, %arg130: tensor<!tf.resource>, %arg131: tensor<!tf.resource>, %arg132: tensor<!tf.resource>, %arg133: tensor<!tf.resource>, %arg134: tensor<!tf.resource>, %arg135: tensor<!tf.resource>, %arg136: tensor<!tf.resource>, %arg137: tensor<!tf.resource>, %arg138: tensor<!tf.resource>, %arg139: tensor<!tf.resource>, %arg140: tensor<!tf.resource>, %arg141: tensor<!tf.resource>, %arg142: tensor<!tf.resource>, %arg143: tensor<!tf.resource>, %arg144: tensor<!tf.resource>, %arg145: tensor<!tf.resource>, %arg146: tensor<!tf.resource>, %arg147: tensor<!tf.resource>, %arg148: tensor<!tf.resource>, %arg149: tensor<!tf.resource>, %arg150: tensor<!tf.resource>, %arg151: tensor<!tf.resource>, %arg152: tensor<!tf.resource>, %arg153: tensor<!tf.resource>, %arg154: tensor<!tf.resource>, %arg155: tensor<!tf.resource>, %arg156: tensor<!tf.resource>, %arg157: tensor<!tf.resource>, %arg158: tensor<!tf.resource>, %arg159: tensor<!tf.resource>, %arg160: tensor<!tf.resource>, %arg161: tensor<!tf.resource>, %arg162: tensor<!tf.resource>, %arg163: tensor<!tf.resource>, %arg164: tensor<!tf.resource>, %arg165: tensor<!tf.resource>, %arg166: tensor<!tf.resource>, %arg167: tensor<!tf.resource>, %arg168: tensor<!tf.resource>, %arg169: tensor<!tf.resource>, %arg170: tensor<!tf.resource>, %arg171: tensor<!tf.resource>, %arg172: tensor<!tf.resource>, %arg173: tensor<!tf.resource>, %arg174: tensor<!tf.resource>, %arg175: tensor<!tf.resource>, %arg176: tensor<!tf.resource>, %arg177: tensor<!tf.resource>, %arg178: tensor<!tf.resource>, %arg179: tensor<!tf.resource>, %arg180: tensor<!tf.resource>, %arg181: tensor<!tf.resource>, %arg182: tensor<!tf.resource>, %arg183: tensor<!tf.resource>, %arg184: tensor<!tf.resource>, %arg185: tensor<!tf.resource>, %arg186: tensor<!tf.resource>, %arg187: tensor<!tf.resource>, %arg188: tensor<!tf.resource>, %arg189: tensor<!tf.resource>, %arg190: tensor<!tf.resource>, %arg191: tensor<!tf.resource>, %arg192: tensor<!tf.resource>, %arg193: tensor<!tf.resource>, %arg194: tensor<!tf.resource>, %arg195: tensor<!tf.resource>, %arg196: tensor<!tf.resource>, %arg197: tensor<!tf.resource>, %arg198: tensor<!tf.resource>, %arg199: tensor<!tf.resource>, %arg200: tensor<!tf.resource>, %arg201: tensor<!tf.resource>, %arg202: tensor<!tf.resource>, %arg203: tensor<!tf.resource>, %arg204: tensor<!tf.resource>, %arg205: tensor<!tf.resource>, %arg206: tensor<!tf.resource>, %arg207: tensor<!tf.resource>, %arg208: tensor<!tf.resource>, %arg209: tensor<!tf.resource>, %arg210: tensor<!tf.resource>, %arg211: tensor<!tf.resource>, %arg212: tensor<!tf.resource>, %arg213: tensor<!tf.resource>, %arg214: tensor<!tf.resource>, %arg215: tensor<!tf.resource>, %arg216: tensor<!tf.resource>, %arg217: tensor<!tf.resource>, %arg218: tensor<!tf.resource>, %arg219: tensor<!tf.resource>, %arg220: tensor<!tf.resource>, %arg221: tensor<!tf.resource>, %arg222: tensor<!tf.resource>, %arg223: tensor<!tf.resource>, %arg224: tensor<!tf.resource>, %arg225: tensor<!tf.resource>, %arg226: tensor<!tf.resource>, %arg227: tensor<!tf.resource>, %arg228: tensor<!tf.resource>, %arg229: tensor<!tf.resource>, %arg230: tensor<!tf.resource>, %arg231: tensor<!tf.resource>, %arg232: tensor<!tf.resource>, %arg233: tensor<!tf.resource>, %arg234: tensor<!tf.resource>, %arg235: tensor<!tf.resource>, %arg236: tensor<!tf.resource>, %arg237: tensor<!tf.resource>, %arg238: tensor<!tf.resource>, %arg239: tensor<!tf.resource>, %arg240: tensor<!tf.resource>, %arg241: tensor<!tf.resource>, %arg242: tensor<!tf.resource>, %arg243: tensor<!tf.resource>, %arg244: tensor<!tf.resource>, %arg245: tensor<!tf.resource>, %arg246: tensor<!tf.resource>, %arg247: tensor<!tf.resource>, %arg248: tensor<!tf.resource>, %arg249: tensor<!tf.resource>, %arg250: tensor<!tf.resource>, %arg251: tensor<!tf.resource>, %arg252: tensor<!tf.resource>, %arg253: tensor<!tf.resource>, %arg254: tensor<!tf.resource>, %arg255: tensor<!tf.resource>, %arg256: tensor<!tf.resource>, %arg257: tensor<!tf.resource>, %arg258: tensor<!tf.resource>, %arg259: tensor<!tf.resource>, %arg260: tensor<!tf.resource>, %arg261: tensor<!tf.resource>, %arg262: tensor<!tf.resource>, %arg263: tensor<!tf.resource>, %arg264: tensor<!tf.resource>, %arg265: tensor<!tf.resource>, %arg266: tensor<!tf.resource>, %arg267: tensor<!tf.resource>, %arg268: tensor<!tf.resource>, %arg269: tensor<!tf.resource>, %arg270: tensor<!tf.resource>, %arg271: tensor<!tf.resource>, %arg272: tensor<!tf.resource>, %arg273: tensor<!tf.resource>, %arg274: tensor<!tf.resource>, %arg275: tensor<!tf.resource>, %arg276: tensor<!tf.resource>, %arg277: tensor<!tf.resource>, %arg278: tensor<!tf.resource>, %arg279: tensor<!tf.resource>, %arg280: tensor<!tf.resource>, %arg281: tensor<!tf.resource>, %arg282: tensor<!tf.resource>, %arg283: tensor<!tf.resource>, %arg284: tensor<!tf.resource>, %arg285: tensor<!tf.resource>, %arg286: tensor<!tf.resource>, %arg287: tensor<!tf.resource>, %arg288: tensor<!tf.resource>, %arg289: tensor<!tf.resource>, %arg290: tensor<!tf.resource>, %arg291: tensor<!tf.resource>, %arg292: tensor<!tf.resource>, %arg293: tensor<!tf.resource>, %arg294: tensor<!tf.resource>, %arg295: tensor<!tf.resource>, %arg296: tensor<!tf.resource>, %arg297: tensor<!tf.resource>, %arg298: tensor<!tf.resource>, %arg299: tensor<!tf.resource>, %arg300: tensor<!tf.resource>, %arg301: tensor<!tf.resource>, %arg302: tensor<!tf.resource>, %arg303: tensor<!tf.resource>, %arg304: tensor<!tf.resource>, %arg305: tensor<!tf.resource>, %arg306: tensor<!tf.resource>, %arg307: tensor<!tf.resource>, %arg308: tensor<!tf.resource>, %arg309: tensor<!tf.resource>, %arg310: tensor<!tf.resource>, %arg311: tensor<!tf.resource>, %arg312: tensor<!tf.resource>, %arg313: tensor<!tf.resource>, %arg314: tensor<!tf.resource>, %arg315: tensor<!tf.resource>, %arg316: tensor<!tf.resource>, %arg317: tensor<!tf.resource>, %arg318: tensor<!tf.resource>, %arg319: tensor<!tf.resource>, %arg320: tensor<!tf.resource>) -> tensor<?x1000xf32> attributes {tf._construction_context = "kEagerRuntime", tf._input_shapes = [#tf.shape<?x224x224x3>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>], tf.signature.is_stateful} {
  ^
tf_executor.mlir:789:61: error: 'tf.ReadVariableOp' op is not legalizable
      %outputs_928, %control_929 = tf_executor.island wraps "tf.ReadVariableOp"(%arg270) {device = ""} : (tensor<!tf.resource>) -> tensor<512xf32>
                                                            ^
tf_executor.mlir:789:61: note: see current operation: %1767 = "tf.ReadVariableOp"(%arg270) {device = ""} : (tensor<!tf.resource>) -> tensor<512xf32>
tf_executor.mlir:900:3: error: The following operations cannot be legalized: tf.AssignVariableOp (count: 2); tf.FusedBatchNormV3 (count: 1); tf.ReadVariableOp (count: 4). These legalization failure(s) may be due to missing TF to HLO lowerings and/or unsupported attributes, etc.
  func private @__inference_conv1_bn_layer_call_and_return_conditional_losses_132020(%arg0: tensor<?x112x112x64xf32> {tf._user_specified_name = "inputs"}, %arg1: tensor<!tf.resource>, %arg2: tensor<!tf.resource>, %arg3: tensor<!tf.resource>, %arg4: tensor<!tf.resource>) -> tensor<?x112x112x64xf32> attributes {tf._construction_context = "kEagerRuntime", tf._input_shapes = [#tf.shape<?x112x112x64>, #tf.shape<>, #tf.shape<>, #tf.shape<>, #tf.shape<>], tf.signature.is_stateful} {


Am I giving command line options correctly?

Thanks

Jacques Pienaar

unread,
Aug 9, 2021, 12:05:00 PM8/9/21
to Aruna Kote, Catherine Payne, MLIR, Uday Bondhugula

Hey,

Seems like you are missing shape inference and so the variable hoisting couldn't happen. Either that or you have a variable which is not uniform and so can't be converted to XLA usage (`%outputs_928, %control_929 = tf_executor.island wraps "tf.ReadVariableOp"(%arg270) {device = ""} : (tensor<!tf.resource>) -> tensor<512xf32>` seems to be missing shape on tf.resource). Run with or look at passes from tf-tpu-bridge (that is first phase of bridge), and then -tf-to-hlo-pipeline (for 2nd phase of bridge - you probably need to run these on different graphs though, as the latter is intended on subgraph to be compiled).

-- Jacques

--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/a2f17259-3cbc-42cf-8601-4a3a7783896dn%40tensorflow.org.
Reply all
Reply to author
Forward
0 new messages