(self)
return tl.Fn('ValueMean', f)
The mean value of actions selected by the behavioral policy.
The mean value of actions selected by the behavioral policy.
The mean value of actions selected by the behavioral policy .
def value_mean(self):
    """The mean value of actions selected by the behavioral policy."""
    def f(values, actions, returns, mask):
      ind_0, ind_1 = np.indices(actions.shape)
      # We calculate length using the shape of returns
      # and adequatly remove a superflous slice of values.
      # An analogous operation is done in value_batches_stream.
      length = returns.shape[1]
      values = values[:, :length, :]
      selected_values = values[ind_0, ind_1, actions]
      shapes.assert_same_shape(selected_values, returns)
      shapes.assert_same_shape(selected_values, mask)
      return jnp.sum(selected_values) / jnp.sum(mask)
    return tl.Fn('ValueMean', f)
def value_mean ( self ) : def f ( values , actions , returns , mask ) : ind_0 , ind_1 = np . indices ( actions . shape ) # We calculate length using the shape of returns # and adequatly remove a superflous slice of values. # An analogous operation is done in value_batches_stream. length = returns . shape [ 1 ] values = values [ : , : length , : ] selected_values = values [ ind_0 , ind_1 , actions ] shapes . assert_same_shape ( selected_values , returns ) shapes . assert_same_shape ( selected_values , mask ) return jnp . sum ( selected_values ) / jnp . sum ( mask ) return tl . Fn ( 'ValueMean' , f )