def one_hot_encoding(target, n_classes, on_value=1.0, off_value=0.0, name='OneHotEncoding'):
 with tf.name_scope(name):
  if (target.dtype != dtypes.int64):
   target = standard_ops.to_int64(target)
  target = standard_ops.one_hot(target, n_classes, on_value=on_value, off_value=off_value)
 tf.add_to_collection(((tf.GraphKeys.LAYER_TENSOR + '/') + name), target)
 return target

def one_hot_encoding ( target , n_classes , on_value = 1.0 , off_value = 0.0 , name = 'OneHotEncoding' ) : with tf . name_scope ( name ) : if ( target . dtype != dtypes . int64 ) : target = standard_ops . to_int64 ( target ) target = standard_ops . one_hot ( target , n_classes , on_value = on_value , off_value = off_value ) tf . add_to_collection ( ( ( tf . GraphKeys . LAYER_TENSOR + '/' ) + name ) , target ) return target
one hot encoding .