I have a client-server design using Pyro4, in which the client code is as follows:
import Pyro4
uri = 'PYRO:PYRO_SERVER@123.123.123.123:10000
test_1 = Pyro4.Proxy(uri)
test_1.run_model()
The server-side code is as follows:
import Pyro4
import socket
from keras.models import Sequential
from keras.layers import LSTM
import tensorflow as tf
@Pyro4.expose
class PyroServer(object):
def run_model(self):
session = tf.Session()
session.run(tf.global_variables_initializer())
session.run(tf.local_variables_initializer())
session.run(tf.tables_initializer())
session.run(tf.variables_initializer([]))
tf.reset_default_graph()
model = Sequential()
model.add(LSTM(25, input_shape=(5, 10)))
host_name = socket.gethostbyname(socket.getfqdn())
daemon = Pyro4.Daemon(host = host_name,port = 10000)
uri = daemon.register(PyroServer,objectId = 'PYRO_SERVER')
daemon.requestLoop()
After the server is started, the first call from the client to the run_model() method functions properly. For the second, and all subsequent calls, the following error message is displayed:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Pyro4/core.py", line 187, in call
return self.__send(self.__name, args, kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Pyro4/core.py", line 472, in _pyroInvoke
raise data # if you see this in your traceback, you should probably inspect the remote traceback as well
ValueError: Fetch argument cannot be interpreted as a Tensor. (Operation name: "lstm_1/init"
op: "NoOp"
input: "^lstm_1/kernel/Assign"
input: "^lstm_1/recurrent_kernel/Assign"
input: "^lstm_1/bias/Assign"
is not an element of this graph.)
Can anyone suggest a possible solution for this?