models/moa_model.py
def _reshaped_one_hot_actions(self, actions_tensor, name):
        """
        Converts the collection of all actions from a number encoding to a one-hot encoding.
        Then, flattens the one-hot encoding so that all concatenated one-hot vectors are the same
        dimension. E.g. with a num_outputs (action_space.n) of 3:
        _reshaped_one_hot_actions([0,1,2]) returns [1,0,0,0,1,0,0,0,1]
        :param actions_tensor: The tensor containing actions.
        :return: Tensor containing one-hot reshaped action values.
        """
        one_hot_actions = tf.keras.backend.one_hot(actions_tensor, self.num_outputs)
        # Extract partially known tensor shape and combine with actions_layer known shape
        # This combination is a bit contrived for a reason: the shape cannot be determined otherwise
        batch_time_dims = [
            tf.shape(one_hot_actions)[k] for k in range(one_hot_actions.shape.rank - 2)
        ]
        reshape_dims = batch_time_dims + [actions_tensor.shape[-1] * self.num_outputs]
        reshaped = tf.reshape(one_hot_actions, shape=reshape_dims, name=name)
        return reshaped

        Converts the collection of all actions from a number encoding to a one-hot encoding.
        Then, flattens the one-hot encoding so that all concatenated one-hot vectors are the same
        dimension. E.g. with a num_outputs (action_space.n) of 3:
        _reshaped_one_hot_actions([0,1,2]) returns [1,0,0,0,1,0,0,0,1]
        :param actions_tensor: The tensor containing actions.
        :return: Tensor containing one-hot reshaped action values.
        
Converts the collection of all actions from a number encoding to a one-hot encoding.
Then, flattens the one-hot encoding so that all concatenated one-hot vectors are the same
dimension.
Converts the collection of all actions from a number encoding to a one - hot encoding . Then flattens the one - hot encoding so that all concatenated one - hot vectors are the same dimension .
def _reshaped_one_hot_actions(self, actions_tensor, name):
        one_hot_actions = tf.keras.backend.one_hot(actions_tensor, self.num_outputs)
        batch_time_dims = [
            tf.shape(one_hot_actions)[k] for k in range(one_hot_actions.shape.rank - 2)
        ]
        reshape_dims = batch_time_dims + [actions_tensor.shape[-1] * self.num_outputs]
        reshaped = tf.reshape(one_hot_actions, shape=reshape_dims, name=name)
        return reshaped
def _reshaped_one_hot_actions ( self , actions_tensor , name ) : one_hot_actions = tf . keras . backend . one_hot ( actions_tensor , self . num_outputs ) batch_time_dims = [ tf . shape ( one_hot_actions ) [ k ] for k in range ( one_hot_actions . shape . rank - 2 ) ] reshape_dims = batch_time_dims + [ actions_tensor . shape [ - 1 ] * self . num_outputs ] reshaped = tf . reshape ( one_hot_actions , shape = reshape_dims , name = name ) return reshaped
Converts the collection of all actions from a number encoding to a one-hot encoding.
Converts the collection of all actions from a number encoding to a one - hot encoding .
"""
        Converts the collection of all actions from a number encoding to a one-hot encoding.
        Then, flattens the one-hot encoding so that all concatenated one-hot vectors are the same
        dimension. E.g. with a num_outputs (action_space.n) of 3:
        _reshaped_one_hot_actions([0,1,2]) returns [1,0,0,0,1,0,0,0,1]
        :param actions_tensor: The tensor containing actions.
        :return: Tensor containing one-hot reshaped action values.
        """ # Extract partially known tensor shape and combine with actions_layer known shape # This combination is a bit contrived for a reason: the shape cannot be determined otherwise
Tensor containing one-hot reshaped action values.
Tensor containing one - hot reshaped action values .
self
actions_tensor
The tensor containing actions.
The tensor containing actions .
name