def _get_hidden_node_location(flattened_index, num_rows, num_columns):
  """Converts the flattened index of a hidden node to its index in the 3D array.

  Converts the index of a hidden node in the first convolution layer (flattened)
  into its location- row, column, and channel in the 3D activation map. The
  3D activation map has dimensions: (num_channels, num_rows, num_columns).

  Args:
    flattened_index: int, index of a hidden node in the first convolution
        layer after it is flattened.
    num_rows: int, number of rows in the activation map produced by each
        kernel.
    num_columns: int, number of columns in the activation map produced by each
        kernel.

  Returns:
    channel: int, channel number of the activation map to which the hidden node
        belongs to.
    row: int, row number of the hidden node in the activation map.
    column: int, column number of the hidden node in the activation map.
  """
  total = num_rows * num_columns
  output_activation_map_row = (flattened_index % total) // num_columns
  output_activation_map_column = (flattened_index % total) % num_columns
  return (flattened_index // total,
          output_activation_map_row,
          output_activation_map_column)