title: Keras - K.print not working in Loss Function
body: <p>I have written a custom loss function <code>adjusted_r2</code>. I am trying to print the tensor values inside the function, but when Logs are printed, I don't see anything. Could somebody help me in this.</p>
  
  <pre><code>def coeff_determination(y_true, y_pred):
      from keras import backend as K
      SS_res =  K.sum(K.square( y_true-y_pred ))
      SS_tot = K.sum(K.square( y_true - K.mean(y_true) ) )
  
      SS_res = K.print_tensor(SS_res, message='SS_res = ')
      SS_tot = K.print_tensor(SS_tot, message='SS_tot = ')
  
      r_squared = 1 - SS_res/(SS_tot + K.epsilon())
  
      r_squared = K.print_tensor(r_squared, message='r_squared = ')
  
  
      adj_r_squared = 1 -( (1-r_squared)*K.cast(K.shape(y_true)[0]-1,"float32")/K.cast((K.shape(y_true)[0]-n_features-1),"float32"))
  
      adj_r_squared = K.print_tensor(adj_r_squared, message='adj_r_squared = ')
  
      return -adj_r_squared
  </code></pre>
  
  <p>Logs are :</p>
  
  <pre><code>1/250 [..............................] - ETA: 51:44 - loss: -6.7060 - coeff_determination: -6.7060 - mean_squared_error: 40.5785
  
   2/250 [..............................] - ETA: 42:56 - loss: -7.2036 - coeff_determination: -7.2036 - mean_squared_error: 48.8251
  
   3/250 [..............................] - ETA: 41:30 - loss: -8.0279 - coeff_determination: -8.0279 - mean_squared_error: 48.1565
  
   4/250 [..............................] - ETA: 40:48 - loss: -9.1016 - coeff_determination: -9.1016 - mean_squared_error: 51.9965
  </code></pre>