def _variable_with_weight_decay(name, shape, stddev, wd):
 var = _variable_on_cpu(name, shape, tf.truncated_normal_initializer(stddev=stddev))
 if (wd is not None):
  weight_decay = tf.mul(tf.nn.l2_loss(var), wd, name='weight_loss')
  tf.add_to_collection('losses', weight_decay)
 return var

def _variable_with_weight_decay ( name , shape , stddev , wd ) : var = _variable_on_cpu ( name , shape , tf . truncated_normal_initializer ( stddev = stddev ) ) if ( wd is not None ) : weight_decay = tf . mul ( tf . nn . l2_loss ( var ) , wd , name = 'weight_loss' ) tf . add_to_collection ( 'losses' , weight_decay ) return var
helper to create an initialized variable with weight decay .