code: def _build_layers(network, layers=None, layer_hparams=None):
      """Builds layers.
  
      Either :attr:`layer_hparams` or :attr:`layers` must be
      provided. If both are given, :attr:`layers` will be used.
  
      Args:
          network: An instance of a subclass of
              :class:`~texar.tf.modules.networks.network_base.FeedForwardNetworkBase`
          layers (optional): A list of layer instances.
          layer_hparams (optional): A list of layer hparams, each to which
              is fed to :func:`~texar.tf.core.layers.get_layer` to create the
              layer instance.
      """
      with tf.variable_scope(network.variable_scope):
          if layers is not None:
              network._layers = layers
          else:
              if layer_hparams is None:
                  raise ValueError(
                      "Either `layer` or `layer_hparams` is required."
                  )
              network._layers = []
              for _, hparams in enumerate(layer_hparams):
                  network._layers.append(get_layer(hparams=hparams))
  
      for layer in network._layers:
          layer_name = uniquify_str(layer.name, network._layer_names)
          network._layer_names.append(layer_name)
          network._layers_by_name[layer_name] = layer
  
imports: import tensorflow
  from texar.tf.module_base import ModuleBase
  from texar.tf.utils import TexarError
  from texar.tf.core.layers import get_layer
  from texar.tf.utils.utils import uniquify_str
  from texar.tf.utils.mode import is_train_mode
label_desc: Use image node_id 1 for calling a global function with example usage: _build_layers(network, layers, layer_hparams) without return types