Hello,
I’m trying to share layers of my custom ModelV2 NN model between two policies.
I tried as noted in the documentation https://docs.ray.io/en/master/rllib-env.html#variable-sharing-between-policies where is said I can just put layers in global variables and directly share those layer objects between policy models.
But already for the “first connection” between a local layer and a globally shared layer I get this error:
ValueError: Tensor("hoist1/dense_self_hoist/kernel/Read/ReadVariableOp:0", shape=(512, 256), dtype=float32) must be from the same graph as Tensor("hoist1/embedded_self_hoist/Relu:0", shape=(?, ?, 1, 512), dtype=float32) (graphs are <tensorflow.python.framework.ops.Graph object at 0x7f1e3033d9d0> and <tensorflow.python.framework.ops.Graph object at 0x7f1d2ef7f0a0>).
What am I doing wrong? I globally share some layers in the manner showed in the example:
https://github.com/ray-project/ray/blob/ef944bc5f0d7764cd99d50500e470eac005a3d01/rllib/examples/models/shared_weights_model.py#L20