Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Anjam__Khayam
Beginner
160 Views

Graph contains a cycle. Can not proceed. Version. [2019.2.0-436-gf5827d4]

Hi, I came across this error while trying to optimize a frozen model using OpenVINO, 

Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.CheckForCycle.CheckForCycle'>): Graph contains a cycle. Can not proceed. 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #97. 

I tested my .pb model with tensorboard and they are no cycles. My model is as following,

model.add(tf.keras.layers.LSTM(units=50,  input_shape=(X.shape[1],2)))
model.add(tf.keras.layers.Dense(units=1))
model.compile(optimizer='adam', loss='mean_squared_error', metrics=['accuracy'])
model.summary()
history = model.fit(X, y, epochs=500, batch_size=32, verbose=1)

 This is how I am running the optimizer

!python3 {mo_tf_path} --input_model {pb_file} --output_dir {output_dir} --input_shape {input_shape_str} --data_type FP32

What could be wrong here? I came across this which points to a bug in mo_tf utility. Is this issue related to that? 

Any help is much appreciated. I have also attached the .pb file in a compressed zip file.

 

0 Kudos
3 Replies
Shubha_R_Intel
Employee
160 Views

Dearest Anjam, Khayam,

According to what I saw in Tensorboard (see attached *.png) I definitely see a cycle. Look at the far right side of the graph starting with strided_slice. I see a closed loop.

tb3.png

Let me know your thoughts,

Thanks,

Shubha

Anjam__Khayam
Beginner
160 Views

Thanks for the response but I dont think that is a cycle. Isn't a cycle means if we start from strided_slice, there is a way to get back to it? I don't see loops or bidirectional links here. Can you elaborateit a bit more?

Shubha_R_Intel
Employee
160 Views

Dearest Anjam, Khayam,

Maybe in the strictest sense that is not a real directed graph cycle. But it does form a closed loop. Let me ask you this, please do a --log_level DEBUG. What node does Model Optimizer complain about with "Graph contains a cycle. Can not proceed. " ? If it is the same node as what I posted above in the tensorboard snippet, then you have your answer. If it's some other node which it complains about we can fire up Tensorboard and investigate further.

Let me know,

Thanks,

Shubha

Reply