|
a |
|
b/A3C/test.py |
|
|
1 |
import tensorflow as tf |
|
|
2 |
import numpy as np |
|
|
3 |
|
|
|
4 |
x = tf.placeholder(tf.float32, [batch_size, 10, 16]) |
|
|
5 |
|
|
|
6 |
with tf.Session() as sess: |
|
|
7 |
mu = tf.placeholder(shape=[3],dtype=tf.float32) |
|
|
8 |
var = tf.placeholder(shape=[3],dtype=tf.float32) |
|
|
9 |
normal = tf.distributions.Normal(mu,tf.sqrt(var)) |
|
|
10 |
act = tf.placeholder(shape=[3],dtype=tf.float32) |
|
|
11 |
log_prob = normal.log_prob(act) |
|
|
12 |
entropy = normal.entropy() |
|
|
13 |
feed_dict={mu:np.zeros(3),var:np.ones(3)*20,act:np.array([0,-0.5,1])} |
|
|
14 |
print sess.run([log_prob,entropy],feed_dict=feed_dict) |