Keras error when predicting on multithreading

后端 未结 1 531
谎友^
谎友^ 2021-01-14 06:36

I\'m trying to create four threads (each one with its own graph and model) that will run concurently and issue predictions in the same way.

My thread code is somethi

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-14 07:16

    I have figured what I was doing wrong. My thinking was right but I shouldn't have recreated the Graph and Session below. The bottom part of the code should simply be:

        thread_locker.acquire()
        with thread_graph.as_default():
            with thread_session.as_default():
                pred_data= model.predict(X_pred)
        thread_locker.release()
    

    0 讨论(0)
提交回复
热议问题