Add most_specific_compatible_shape method in NoneTensorSpec. Otherwise when code will raise error when interleaving datasets with None in the flatten view.

PiperOrigin-RevId: 336794652
Change-Id: I121f61f6f583ed38a92d4df9fc3322ca09be12e5
This commit is contained in:
A. Unique TensorFlower 2020-10-12 19:41:27 -07:00 committed by TensorFlower Gardener
parent 8ce3836a79
commit d33ae4ffe8

View File

@ -537,6 +537,12 @@ class NoneTensorSpec(type_spec.BatchableTypeSpec):
def _to_legacy_output_classes(self):
return self
def most_specific_compatible_shape(self, other):
if type(self) is not type(other):
raise ValueError("No TypeSpec is compatible with both %s and %s" %
(self, other))
return self
type_spec.register_type_spec_from_value_converter(type(None),
NoneTensorSpec.from_value)