Closed dadadahei closed 3 years ago
You need to break out of the infinite iterator in your main program based on your desired conditions.
Thank you for your reply sincerely. I have sovled this problem. As you said, I didn't give a condition that can braek out the iterator. Thank you again!
------------------ 原始邮件 ------------------ 发件人: "vuptran/graph-representation-learning" @.>; 发送时间: 2021年4月20日(星期二) 晚上11:47 @.>; @.**@.>; 主题: Re: [vuptran/graph-representation-learning] Iterator got infinite cycle (#7)
You need to break out of the infinite iterator in your main program based on your desired conditions.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Dear Phi, In the following piece of code you used to generate the batch_data, when running
a, t, f, y, m = zip(*[next(data) for i in range(batch_size)]),
the program seems to enter an infinite loop, with no final result output and no error display.I want know how to solve it.Thank you!train_data = generate_data(adj, train, feats, y_train, mask_train, shuffle=True) batch_data = batch_data(train_data, train_batch_size)
def batch_data(data, batch_size): while True: # this flag yields an infinite generator a, t, f, y, m = zip(*[next(data) for i in range(batch_size)]) a = np.vstack(a) print("true-a") t = np.vstack(t) f = np.vstack(f) y = np.vstack(y) m = np.vstack(m) yield map(np.float32, (a, t, f, y, m))