def build_model(n=200, dim=(30, 4)): inputs = tf.keras.layers.Input(dim) x = base.bese_net(inputs) out = output(x, n) return tf.keras.Model(inputs, out)
def build_model(n=200, dim=(130, 4)): inputs = tf.keras.layers.Input(dim, name="inputs") x = base.bese_net(inputs) x = tf.keras.layers.Flatten()(x) out = output(x, n) return tf.keras.Model(inputs, out)
def ne_critic(dim=(10,4)): states = tf.keras.layers.Input(dim, name="states") action = tf.keras.layers.Input((2,), name="action") x = base.bese_net(states) x_action = tf.keras.layers.Concatenate()([x, action]) q1 = output(x_action, "q1") q2 = output(x_action, "q2") v = output(x, "v")
def critic(dim): states = tf.keras.layers.Input(dim, name="states") action = tf.keras.layers.Input((2,), name="action") x = base.bese_net(states) x_action = tf.keras.layers.Concatenate()([x, action]) q1 = output(x_action, "q1") q2 = output(x_action, "q2") v = output(x, "v") return tf.keras.Model([states, action], [q1, q2, v])
def critic(input_shape): s = tf.keras.layers.Input(input_shape, name="s") a = tf.keras.layers.Input((2,), name="a") x = base.bese_net(s) f = tf.keras.layers.Flatten()(x) x = tf.keras.layers.Concatenate()([f, a]) q1 = q(x, "q1") q2 = q(x, "q2") return tf.keras.Model([s, a], [q1, q2])
def build_model(n=200, dim=(130, 4)): inputs = tf.keras.layers.Input(dim, name="inputs") x = base.bese_net(inputs) x = tf.keras.layers.Flatten()(x) x = IndependentDense(512, "elu")(x) advantage = output(x, n) value = IndependentDense(n)(x) value = tf.reshape(value, (-1,1,n)) sub = advantage - tf.reshape(tf.reduce_mean(advantage, 1), (-1,1,n)) out = tf.keras.layers.Add(name="q")([value, sub]) return tf.keras.Model(inputs, out)
def build_model(dim=(130, 4)): inputs = tf.keras.layers.Input(dim) x = base.bese_net(inputs) x = tf.keras.layers.Flatten()(x) # x = tf.keras.layers.GRU(128)(x) x = tf.keras.layers.Dense(512, "elu")(x) out = tf.keras.layers.Dense(3, name="q")(x) # v = tf.keras.layers.Dense(328, "elu", kernel_initializer="he_normal")(x) # v = tf.keras.layers.Dense(1, name="v")(v) # a = tf.keras.layers.Dense(328, "elu", kernel_initializer="he_normal")(x) # a = tf.keras.layers.Dense(2, name="a")(a) # out = v + tf.subtract(a, tf.reduce_mean(a, axis=1, keepdims=True)) return tf.keras.Model(inputs, out)
def build_model(dim=(30, 4)): inputs = tf.keras.layers.Input(dim) x = base.bese_net(inputs) tensor_action, tensor_validation = tf.split(x, 2, 1) v = tf.keras.layers.Dense( 328, "elu", kernel_initializer="he_normal")(tensor_validation) # v = tf.keras.layers.BatchNormalization()(v) v = tf.keras.layers.Dense(1, name="v")(v) a = tf.keras.layers.Dense(328, "elu", kernel_initializer="he_normal")(tensor_action) # a = tf.keras.layers.BatchNormalization()(a) a = tf.keras.layers.Dense(2, name="a")(a) out = v + tf.subtract(a, tf.reduce_mean(a, axis=1, keepdims=True)) return tf.keras.Model(inputs, out)