Skip to content

Instantly share code, notes, and snippets.

@PENGZhaoqing
Last active March 23, 2019 03:56
Show Gist options
  • Select an option

  • Save PENGZhaoqing/720c4379b95d79b149f09720321b31cb to your computer and use it in GitHub Desktop.

Select an option

Save PENGZhaoqing/720c4379b95d79b149f09720321b31cb to your computer and use it in GitHub Desktop.

Revisions

  1. PENGZhaoqing renamed this gist Mar 23, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. PENGZhaoqing created this gist Mar 23, 2019.
    21 changes: 21 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    def build(self):
    """
    Builds the full Keras model and stores it in self.model.
    """
    mc = self.config.model
    in_x = x = Input((1, 12, 54))

    x = Flatten(name='initial_flatten')(x)
    x = Dense(1024,activation='relu')(x)

    res_out = x

    # for policy out
    x = Dense(512, activation='relu')(res_out)
    policy_out = Dense(self.config.n_labels, activation="softmax",name="policy_out")(x)

    # for value output
    x = Dense(128, activation='relu')(res_out)
    value_out = Dense(1,name="value_out")(x)

    self.model = Model(in_x, [policy_out, value_out], name="chess_model")