code: def normalize_per_sample(
      data_feature,
      data_attribute,
      data_feature_outputs,
      data_attribute_outputs,
      eps=1e-4,
  ):
      # assume all samples have maximum length
      data_feature_min = np.amin(data_feature, axis=1)
      data_feature_max = np.amax(data_feature, axis=1)
  
      additional_attribute = []
      additional_attribute_outputs = []
  
      dim = 0
      for output in data_feature_outputs:
          if output.type_ == OutputType.CONTINUOUS:
              for _ in range(output.dim):
                  max_ = data_feature_max[:, dim] + eps
                  min_ = data_feature_min[:, dim] - eps
  
                  additional_attribute.append((max_ + min_) / 2.0)
                  additional_attribute.append((max_ - min_) / 2.0)
                  additional_attribute_outputs.append(
                      Output(
                          type_=OutputType.CONTINUOUS,
                          dim=1,
                          normalization=output.normalization,
                          is_gen_flag=False,
                      )
                  )
                  additional_attribute_outputs.append(
                      Output(
                          type_=OutputType.CONTINUOUS,
                          dim=1,
                          normalization=Normalization.ZERO_ONE,
                          is_gen_flag=False,
                      )
                  )
  
                  max_ = np.expand_dims(max_, axis=1)
                  min_ = np.expand_dims(min_, axis=1)
  
                  data_feature[:, :, dim] = (
                      data_feature[:, :, dim] - min_
                  ) / (max_ - min_)
                  if output.normalization == Normalization.MINUSONE_ONE:
                      data_feature[:, :, dim] = (
                          data_feature[:, :, dim] * 2.0 - 1.0
                      )
  
                  dim += 1
          else:
              dim += output.dim
  
      real_attribute_mask = [True] * len(data_attribute_outputs) + [
          False
      ] * len(additional_attribute_outputs)
  
      additional_attribute = np.stack(additional_attribute, axis=1)
      data_attribute = np.concatenate(
          [data_attribute, additional_attribute], axis=1
      )
      data_attribute_outputs.extend(additional_attribute_outputs)
  
      return (
          data_feature,
          data_attribute,
          data_attribute_outputs,
          real_attribute_mask,
      )
  
file_path: BigDL/python/chronos/src/bigdl/chronos/simulator/doppelganger/util.py
imports: from .output import OutputType, Output, Normalization
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: normalize_per_sample(data_feature, data_attribute, data_feature_outputs, data_attribute_outputs, eps) and returns: data_feature,  data_attribute,  data_attribute_outputs,  real_attribute_mask