from tensorflow.contrib import layers

        key=lambda x: x.key) if self._linear_feature_columns else None

  def _get_dnn_feature_columns(self):
    return sorted(set(
        self._dnn_feature_columns)) if self._dnn_feature_columns else None

  def _dnn_logits(self, features):
    net = layers.input_from_feature_columns(
        features,
        self._get_dnn_feature_columns(),
        weight_collections=[self._dnn_weight_collection])
    for layer_id, num_hidden_units in enumerate(self._dnn_hidden_units):
      net = layers.legacy_fully_connected(
          net,
          num_hidden_units,
          activation_fn=self._dnn_activation_fn,
          weight_collections=[self._dnn_weight_collection],
          bias_collections=[self._dnn_weight_collection],
          name="hiddenlayer_%d" % layer_id)
      self._add_hidden_layer_summary(net, "hiddenlayer_%d" % layer_id)
    logit = layers.legacy_fully_connected(
        net,
        self._num_label_columns(),
        weight_collections=[self._dnn_weight_collection],
