(1) Are you sure you need it? Minimizing l2 loss will give you the same result as minimizing the RMSE error. (Go through the math: you donβt need to take the square root, since minimizing x ^ 2 still minimizes x for x> 0, and you know that the sum of the heap of squares is positive. Minimizing x * n minimizes x for constant n).
(2) If you need to know the numerical value of the RMSE error, then implement it directly from the RMSE definition:
tf.sqrt(tf.reduce_sum(...)/n)
(You need to know or calculate n - the number of elements in the sum and correctly set the reduction axis in the reduce_sum call).
source share