def __init__(self, env_spec, hidden_layer_sizes=(100, 100), num_skills=None): assert num_skills is not None Serializable.quick_init(self, locals()) Parameterized.__init__(self) self._Da = env_spec.action_space.flat_dim self._Do = env_spec.observation_space.flat_dim self._obs_pl = tf.placeholder( tf.float32, shape=[None, self._Do], name='observation', ) self._action_pl = tf.placeholder( tf.float32, shape=[None, self._Da], name='actions', ) self._name = 'discriminator' self._input_pls = (self._obs_pl, self._action_pl) self._layer_sizes = list(hidden_layer_sizes) + [num_skills] self._output_t = self.get_output_for(*self._input_pls)
def __init__(self, env, dim_g, lr=1E-3, hidden_layers_sizes=(100, 100)): Parameterized.__init__(self) Serializable.quick_init(self, locals()) assert hasattr(env, 'sample_goal') self._env = env self._dim_g = dim_g self._dim_z = dim_g self._layer_sizes = list(hidden_layers_sizes) + [2 * self._dim_z] self._name = 'embedding' self._lr = lr self._training_ops = list() self._create_placeholders() self._zs, self._log_p_zs, self._mus = \ self.get_output_for(self._goals_pl, reuse=False) # M x K x Dz, M x K x 1, M x K x Dz self._fetches = [tf.exp(self._log_p_zs), self._zs, self._mus] self._create_embedding_update() # Initialize all uninitialized variables. This prevents initializing # pre-trained policy and qf and vf variables. self._sess = tf_utils.get_default_session() uninit_vars = [] for var in tf.global_variables(): try: self._sess.run(var) except tf.errors.FailedPreconditionError: uninit_vars.append(var) self._sess.run(tf.variables_initializer(uninit_vars))
def __init__(self, name, input_pls, hidden_layer_sizes): Parameterized.__init__(self) Serializable.quick_init(self, locals()) self._name = name self._input_pls = input_pls self._layer_sizes = list(hidden_layer_sizes) + [None] self._output_t = self.get_output_for(*self._input_pls)
def __init__(self, *inputs, name, hidden_layer_sizes): Parameterized.__init__(self) Serializable.quick_init(self, locals()) self._name = name self._inputs = inputs self._layer_sizes = list(hidden_layer_sizes) + [1] self._output = self._output_for(*self._inputs)
def __init__(self, inputs, name, hidden_layer_sizes): Parameterized.__init__(self) Serializable.quick_init(self, locals()) self._name = name self._inputs = inputs self._layer_sizes = list(hidden_layer_sizes) + [1] self._output = self._output_for(self._inputs)
def __init__(self, env, sess, action_initializer=None): Parameterized.__init__(self) if action_initializer is None: action_initializer = tf.random_uniform_initializer(minval=-0.1, maxval=0.1) with tf.variable_scope('action_optimizer'): self.action = tf.get_variable('planner_action', [1] + list(env.action_space.shape), initializer=action_initializer) self.sess = sess self.env = env
def __init__(self, name, input_pls, input_pls2, hidden_layer_sizes, output_nonlinearity=None, with_alpha=True, const_alpha=False): Parameterized.__init__(self) Serializable.quick_init(self, locals()) self._name = name self._input_pls = input_pls self._input_pls2 = input_pls2 self._layer_sizes = list(hidden_layer_sizes) + [None] self._output_nonlinearity = output_nonlinearity self._output_t = self.get_output_for(*self._input_pls) if with_alpha: if const_alpha: self._alpha_t = self.get_const_alpha_for() else: self._alpha_t = self.get_alpha_for(*self._input_pls2)
def __init__(self, name, input_pls, hidden_layer_sizes, output_nonlinearity=None, batchnorm=False, dropoutvf_placeholder=None, dropoutvf_keep_prob=1.0): Parameterized.__init__(self) Serializable.quick_init(self, locals()) self._name = name self._input_pls = input_pls self._layer_sizes = list(hidden_layer_sizes) + [None] self._output_nonlinearity = output_nonlinearity self._batchnorm = batchnorm self.todropoutvf = (dropoutvf_placeholder is not None) self.dropoutvf_placeholder = dropoutvf_placeholder self.dropoutvf_keep_prob = dropoutvf_keep_prob self._output_t = self.get_output_for(*self._input_pls)
def __init__(self, env_spec, layer_sizes=(128, 16), output_nonlinearity=None, name='observations_preprocessor'): Parameterized.__init__(self) Serializable.quick_init(self, locals()) self._name = name self._Do = env_spec.observation_space.flat_dim obs_ph = tf.placeholder( tf.float32, shape=(None, self._Do), name='observations', ) self._input_pls = (obs_ph, ) self._layer_sizes = layer_sizes self._output_nonlinearity = output_nonlinearity self._output_t = self.get_output_for(obs_ph, reuse=tf.AUTO_REUSE)
def __init__(self, env_spec): Parameterized.__init__(self) self._env_spec = env_spec
def __init__(self, output_layers, input_layers=None): self._output_layers = output_layers self._input_layers = input_layers Parameterized.__init__(self)