This commit is contained in:
jh 2021-03-16 17:19:26 -07:00
commit 08495a199e

View file

@ -498,7 +498,7 @@ Examples: df, liae, df-d, df-ud, liae-ud, ...
print("gpu_pred_src_src_d.shape: ", gpu_pred_src_src_d.shape) print("gpu_pred_src_src_d.shape: ", gpu_pred_src_src_d.shape)
print("gpu_pred_src_src_d2.shape: ", gpu_pred_src_src_d2.shape) print("gpu_pred_src_src_d2.shape: ", gpu_pred_src_src_d2.shape)
print("gpu_pred_src_src_d.reshape([-1]).shape: ", gpu_pred_src_src_d.reshape([-1]).shape) print("tf.reshape(gpu_pred_src_src_d, [-1]).shape: ", tf.reshape(gpu_pred_src_src_d, [-1]).shape)
def get_smooth_noisy_label(label, smoothing=0.2, noise=0.05): def get_smooth_noisy_label(label, smoothing=0.2, noise=0.05):
@ -509,7 +509,7 @@ Examples: df, liae, df-d, df-ud, liae-ud, ...
else: else:
return lambda x: np.random.uniform(1-smoothing/2, 1.0) return lambda x: np.random.uniform(1-smoothing/2, 1.0)
gpu_pred_src_src_d_ones = tf.map_fn (get_smooth_noisy_label(1, smoothing=0.2, noise=0.05), gpu_pred_src_src_d.reshape([-1])).reshape(gpu_pred_src_src_d.shape) gpu_pred_src_src_d_ones = tf.reshape(tf.map_fn (get_smooth_noisy_label(1, smoothing=0.2, noise=0.05), tf.reshape(gpu_pred_src_src_d, [-1])), gpu_pred_src_src_d.shape)
gpu_pred_src_src_d_zeros = tf.map_fn (get_smooth_noisy_label(0, smoothing=0.2, noise=0.05), gpu_pred_src_src_d) gpu_pred_src_src_d_zeros = tf.map_fn (get_smooth_noisy_label(0, smoothing=0.2, noise=0.05), gpu_pred_src_src_d)
print("Shape (gpu_pred_src_src_d_ones): ", gpu_pred_src_src_d.shape) print("Shape (gpu_pred_src_src_d_ones): ", gpu_pred_src_src_d.shape)