@staticmethod
def multiplexer(args, output_size, nb_actions):
    '\n        Returns a tensor of shape (None, output_size) where each sample is\n        the result of masking each sample in full_input with a binary mask that \n        preserves only output_size elements, based on the corresponding control \n        value in indices.\n        '
    (full_input, indices) = args
    '\n        For example, given:\n            full_input: [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]\n            nb_actions: 3\n            output_size: 2\n            indices: [[0], [2]]\n            desired output: [[1, 2], [11, 12]]\n        we want to output the first two elements (index 0) of the first sample \n        and the last two elements (index 2) of the second sample.\n        To do this, we need the absolute indices [[0, 1], [4, 5]].\n\n        To build these, first compute the base absolute indices (0 and 4) by\n        multiplying the control indices for the output size:\n            [[0], [2]] * 2 = [[0], [4]]\n\n        '
    base_absolute_indices = tf.multiply(indices, output_size)
    '\n        Build an array containing the base absolute indices repeated output_size\n         times:\n            [[0, 0], [4, 4]]\n        '
    bai_repeated = tf.tile(base_absolute_indices, [1, output_size])
    '\n        Finally, add range(output_size) to these tensors to get the full\n        absolute indices:\n            [0, 0] + [0, 1] = [0, 1]\n            [4, 4] + [0, 1] = [4, 5]\n        so we have:\n            [[0, 1], [4, 5]]\n        '
    absolute_indices = tf.add(bai_repeated, tf.range(output_size))
    '\n        Flatten this tensor in order to compute the one hot encoding for each \n        absolute index:\n            [0, 1, 4, 5]\n        '
    ai_flat = tf.reshape(absolute_indices, [(- 1)])
    '\n        Compute the one-hot encoding for the absolute indices.\n        From [0, 1, 4, 5] we get:\n            [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0],\n             [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]\n        '
    ai_onehot = tf.one_hot(ai_flat, (output_size * nb_actions))
    '\n        Build the mask for full_input from the one-hot-encoded absolute indices.\n        We need to group the one-hot absolute indices into groups of output_size\n        elements.\n        We get:\n            [\n              [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0]],\n              [[0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]\n            ]\n        '
    group_shape = [(- 1), output_size, (output_size * nb_actions)]
    group = tf.reshape(ai_onehot, group_shape)
    '\n        Reduce_sum along axis 1 to collapse the group and get the binary masks.\n            [[1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1]]\n        '
    masks = tf.reduce_sum(group, axis=1)
    '\n        Convert the mask to boolean.\n            [[True, True, False, False, False, False],\n             [False, False, False, False, True, True]]\n        '
    zero = tf.constant(0, dtype=tf.float32)
    bool_masks = tf.not_equal(masks, zero)
    '\n        Convert the boolean masks back to absolute indices for the full_input\n        tensor (each element represents [sample index, value index]).\n        We get:\n            [[0, 0], [0, 1], [1, 4], [1, 5]]\n        '
    ai_mask = tf.where(bool_masks)
    '\n        Apply the masks to full_input. We get a 1D tensor:\n            [1, 2, 11, 12]\n        '
    reduced_output = tf.gather_nd(full_input, ai_mask)
    '\n        Reshape the reduction to match the output shape.\n        We get:\n            [[1, 2], [11, 12]]\n        '
    return tf.reshape(reduced_output, [(- 1), output_size])
Returns a tensor of shape (None, output_size) where each sample is
the result of masking each sample in full_input with a binary mask that 
preserves only output_size elements, based on the corresponding control 
value in indices.
@staticmethod
def multiplexer(args, output_size, nb_actions):
    '\n        Returns a tensor of shape (None, output_size) where each sample is\n        the result of masking each sample in full_input with a binary mask that \n        preserves only output_size elements, based on the corresponding control \n        value in indices.\n        '
    (full_input, indices) = args
    '\n        For example, given:\n            full_input: [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]]\n            nb_actions: 3\n            output_size: 2\n            indices: [[0], [2]]\n            desired output: [[1, 2], [11, 12]]\n        we want to output the first two elements (index 0) of the first sample \n        and the last two elements (index 2) of the second sample.\n        To do this, we need the absolute indices [[0, 1], [4, 5]].\n\n        To build these, first compute the base absolute indices (0 and 4) by\n        multiplying the control indices for the output size:\n            [[0], [2]] * 2 = [[0], [4]]\n\n        '
    base_absolute_indices = tf.multiply(indices, output_size)
    '\n        Build an array containing the base absolute indices repeated output_size\n         times:\n            [[0, 0], [4, 4]]\n        '
    bai_repeated = tf.tile(base_absolute_indices, [1, output_size])
    '\n        Finally, add range(output_size) to these tensors to get the full\n        absolute indices:\n            [0, 0] + [0, 1] = [0, 1]\n            [4, 4] + [0, 1] = [4, 5]\n        so we have:\n            [[0, 1], [4, 5]]\n        '
    absolute_indices = tf.add(bai_repeated, tf.range(output_size))
    '\n        Flatten this tensor in order to compute the one hot encoding for each \n        absolute index:\n            [0, 1, 4, 5]\n        '
    ai_flat = tf.reshape(absolute_indices, [(- 1)])
    '\n        Compute the one-hot encoding for the absolute indices.\n        From [0, 1, 4, 5] we get:\n            [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0],\n             [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]\n        '
    ai_onehot = tf.one_hot(ai_flat, (output_size * nb_actions))
    '\n        Build the mask for full_input from the one-hot-encoded absolute indices.\n        We need to group the one-hot absolute indices into groups of output_size\n        elements.\n        We get:\n            [\n              [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0]],\n              [[0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]\n            ]\n        '
    group_shape = [(- 1), output_size, (output_size * nb_actions)]
    group = tf.reshape(ai_onehot, group_shape)
    '\n        Reduce_sum along axis 1 to collapse the group and get the binary masks.\n            [[1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 1]]\n        '
    masks = tf.reduce_sum(group, axis=1)
    '\n        Convert the mask to boolean.\n            [[True, True, False, False, False, False],\n             [False, False, False, False, True, True]]\n        '
    zero = tf.constant(0, dtype=tf.float32)
    bool_masks = tf.not_equal(masks, zero)
    '\n        Convert the boolean masks back to absolute indices for the full_input\n        tensor (each element represents [sample index, value index]).\n        We get:\n            [[0, 0], [0, 1], [1, 4], [1, 5]]\n        '
    ai_mask = tf.where(bool_masks)
    '\n        Apply the masks to full_input. We get a 1D tensor:\n            [1, 2, 11, 12]\n        '
    reduced_output = tf.gather_nd(full_input, ai_mask)
    '\n        Reshape the reduction to match the output shape.\n        We get:\n            [[1, 2], [11, 12]]\n        '
    return tf.reshape(reduced_output, [(- 1), output_size])