Fix issue with non-canonical TF version name format.
@@ -3402,8 +3402,8 @@ def _preprocess_conv1d_input(x, data_format):
A tensor.
"""
# tensorflow doesn't support float64 for conv layer before 1.8.0
- if (dtype(x) == 'float64'
- and StrictVersion(tf.__version__) < StrictVersion('1.8.0')):
+ if (dtype(x) == 'float64' and
+ StrictVersion(tf.__version__.split('-')[0]) < StrictVersion('1.8.0')):
x = tf.cast(x, 'float32')
tf_data_format = 'NWC' # to pass TF Conv2dNative operations
if data_format == 'channels_first':
@@ -3425,8 +3425,8 @@ def _preprocess_conv2d_input(x, data_format):
A tensor.
"""
# tensorflow doesn't support float64 for conv layer before 1.8.0
- if (dtype(x) == 'float64'
- and StrictVersion(tf.__version__) < StrictVersion('1.8.0')):
+ if (dtype(x) == 'float64' and
+ StrictVersion(tf.__version__.split('-')[0]) < StrictVersion('1.8.0')):
x = tf.cast(x, 'float32')
tf_data_format = 'NHWC'
if data_format == 'channels_first':
@@ -3448,8 +3448,8 @@ def _preprocess_conv3d_input(x, data_format):
A tensor.
"""
# tensorflow doesn't support float64 for conv layer before 1.8.0
- if (dtype(x) == 'float64'
- and StrictVersion(tf.__version__) < StrictVersion('1.8.0')):
+ if (dtype(x) == 'float64' and
+ StrictVersion(tf.__version__.split('-')[0]) < StrictVersion('1.8.0')):
x = tf.cast(x, 'float32')
tf_data_format = 'NDHWC'
if data_format == 'channels_first':
