Beispiel #1
0
 def _is_v2_column(self):
     return tf_utils.fc2_implements_resources()
Beispiel #2
0
import six
import tensorflow as tf
from tensorflow_hub import image_util
from tensorflow_hub import module
from tensorflow_hub import tf_utils
from tensorflow_hub import tf_v1

# TODO(b/73987364): It is not possible to extend feature columns without
# depending on TensorFlow internal implementation details.
# pylint: disable=g-direct-tensorflow-import
from tensorflow.python.feature_column import feature_column
from tensorflow.python.feature_column import feature_column_v2
# pylint: enable=g-direct-tensorflow-import

if tf_utils.fc2_implements_resources():

    # Use feature columns v2 if available.
    class DenseFeatureColumn(
            feature_column._DenseColumn,  # pylint: disable=protected-access
            feature_column_v2.DenseColumn):
        @property
        def dtype(self):
            return tf.float32
else:

    class DenseFeatureColumn(feature_column._DenseColumn):  # pylint: disable=protected-access
        @property
        def dtype(self):
            return tf.float32