code: def ThermometerEncodingDefence(
      x, y=None, num_space=10, clip_values=(0.0, 1.0)
  ):
      result = []
  
      # for c in range(x.shape[-1]):
      #    result.append(_perchannel(x[:, :, :, c],num_space))
      for c in range(x.shape[1]):
          result.append(_perchannel(x[:, c, :, :], num_space))
  
      result = np.concatenate(result, axis=3)
      result = np.clip(result, clip_values[0], clip_values[1])
  
      return result
  
imports: from builtins import range
  import logging
  import numpy
  from keras.utils import to_categorical
label_desc: Use image node_id 2 for calling a global function with example usage: ThermometerEncodingDefence(x, y, num_space, clip_values) and returns: result