Exemple #1
0
 def get_hyper_preprocessors(self):
     hyper_preprocessors = []
     if self._add_one_dimension:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(preprocessors.AddOneDimension())
         )
     return hyper_preprocessors
def test_serialize_and_deserialize_default_hpps():
    preprocessor = preprocessors.AddOneDimension()
    hyper_preprocessor = hyper_preprocessors.DefaultHyperPreprocessor(preprocessor)
    hyper_preprocessor = hyper_preprocessors.deserialize(
        hyper_preprocessors.serialize(hyper_preprocessor)
    )
    assert isinstance(hyper_preprocessor.preprocessor, preprocessors.AddOneDimension)
Exemple #3
0
 def get_hyper_preprocessors(self):
     hyper_preprocessors = []
     if self._add_one_dimension:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.AddOneDimension()))
     if self.dtype in [tf.uint8, tf.uint16, tf.uint32, tf.uint64]:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.CastToInt32()))
     if not self._encoded and self.dtype != tf.string:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.CastToString()))
     if self.multi_label:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.MultiLabelEncoder()))
     if not self._encoded:
         if self.num_classes == 2 and not self.multi_label:
             hyper_preprocessors.append(
                 hpps_module.DefaultHyperPreprocessor(
                     preprocessors.LabelEncoder(self._labels)))
         else:
             hyper_preprocessors.append(
                 hpps_module.DefaultHyperPreprocessor(
                     preprocessors.OneHotEncoder(self._labels)))
     return hyper_preprocessors
Exemple #4
0
 def get_hyper_preprocessors(self):
     hyper_preprocessors = []
     if not self.has_channel_dim:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.AddOneDimension()))
     return hyper_preprocessors