Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. weights = _variable_with_weight_decay('weights', shape=[dim, 384],
  2.                                       stddev=0.1, wd=0.0)
  3. biases = _variable_on_cpu('biases', [384], tf.constant_initializer(0.001))
  4.  
  5. wx = tf.matmul(reshape, weights)
  6. biases_mul = tf.multiply(biases,0.001)
  7.  
  8. wx_biases = tf.add(wx,biases_mul)
  9.  
  10. w_square= tf.square(weights)
  11. w_sum = tf.reduce_sum(w_square,0)
  12. biases_square = tf.square(biases)
  13. w_biases = tf.add(w_sum,biases_square)
  14. w_norm = tf.sqrt(w_biases)
  15.  
  16. x_square = tf.square(reshape)
  17. x_sum = tf.reduce_sum(x_square,1,keep_dims=True)
  18. biases_send_square = tf.square(0.001)
  19. x_biases = tf.add(x_sum, biases_send_square)
  20. x_norm = tf.sqrt(x_biases)
  21.  
  22. wx_norm_w = tf.div(wx_biases,w_norm)
  23. wx_norm = tf.div(wx_norm_w,x_norm)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement