We will specify the ActorNetwork class and the CriticNetwork class in AandC.py. The steps involved are as follows:
- Importing packages: First, we import the packages:
import tensorflow as tfimport numpy as npimport gymfrom gym import wrappersimport argparseimport pprint as ppimport sysfrom replay_buffer import ReplayBuffer
- Define initializers for the weights and biases: Next, we define the weights and biases initializers:
winit = tf.contrib.layers.xavier_initializer()binit = tf.constant_initializer(0.01)rand_unif = tf.keras.initializers.RandomUniform(minval=-3e-3,maxval=3e-3)regularizer = tf.contrib.layers.l2_regularizer(scale=0.0)
- Defining the ActorNetwork class: The ActorNetwork class is specified as follows. First, ...