Remove clipping on BoundedTensorSpec range.
authorA. Unique TensorFlower <gardener@tensorflow.org>
Tue, 6 Mar 2018 23:20:58 +0000 (15:20 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Tue, 6 Mar 2018 23:24:22 +0000 (15:24 -0800)
PiperOrigin-RevId: 188089885

tensorflow/python/framework/tensor_spec.py

index a0411bc..27a9ab8 100644 (file)
@@ -166,16 +166,8 @@ class BoundedTensorSpec(TensorSpec):
   @classmethod
   def from_spec(cls, spec):
     dtype = dtypes.as_dtype(spec.dtype)
-    if dtype in [dtypes.float64, dtypes.float32]:
-      # Avoid under/over-flow for `dtype.maximum - dtype.minimum`.
-      low = dtype.min / 2
-      high = dtype.max / 2
-    else:
-      low = dtype.min
-      high = dtype.max
-
-    minimum = getattr(spec, "minimum", low)
-    maximum = getattr(spec, "maximum", high)
+    minimum = getattr(spec, "minimum", dtype.min)
+    maximum = getattr(spec, "maximum", dtype.max)
     return BoundedTensorSpec(spec.shape, dtype, minimum, maximum, spec.name)
 
   @property