def relaxed_distance(rx_step):
 (res, ops, rx_done) = ([], [], {})
 for v in tf.trainable_variables():
  if (v.name[0:2] == 'RX'):
   rx_name = v.op.name[(v.name.find('/') + 1):]
   if (rx_name not in rx_done):
    (avg, dist_loss) = relaxed_average(rx_name, rx_step)
    res.append(dist_loss)
    rx_done[rx_name] = avg
   ops.append(v.assign(rx_done[rx_name]))
 return (tf.add_n(res), tf.group(*ops))

def relaxed_distance ( rx_step ) : ( res , ops , rx_done ) = ( [ ] , [ ] , { } ) for v in tf . trainable_variables ( ) : if ( v . name [ 0 : 2 ] == 'RX' ) : rx_name = v . op . name [ ( v . name . find ( '/' ) + 1 ) : ] if ( rx_name not in rx_done ) : ( avg , dist_loss ) = relaxed_average ( rx_name , rx_step ) res . append ( dist_loss ) rx_done [ rx_name ] = avg ops . append ( v . assign ( rx_done [ rx_name ] ) ) return ( tf . add_n ( res ) , tf . group ( * ops ) )
distance between relaxed variables and their average .