In [39]:
import tensorflow as tf
a = tf.constant([1.0, 2.0])
b = tf.constant([3.0, 10.0])
c = a * b
emitX=tf.constant([3.])
emitY=tf.constant([4.])
emitZ=tf.constant([5.])
with tf.Session() as sess:
print "OK"
print sess.run(tf.eye(6))
print sess.run(tf.eye(6)*tf.diag([tf.sqrt(emitX[0]),tf.sqrt(emitX[0]),tf.sqrt(emitY[0]),tf.sqrt(emitY[0]),tf.sqrt(emitZ[0]),tf.sqrt(emitZ[0])]))
In [52]:
def layerTwiss(energyIn,emitX,emitY,emitZ, numPart):
Werights=tf.Variable(tf.eye(6))
covT=Werights*tf.diag([tf.sqrt(emitX[0]),tf.sqrt(emitX[0]),tf.sqrt(emitY[0]),tf.sqrt(emitY[0]),tf.sqrt(emitZ[0]),tf.sqrt(emitZ[0])])
return covT
def Tmp(emitX,emitY,emitZ):
Werights=tf.Variable(tf.eye(6))
return Weights
In [54]:
import tensorflow as tf
energyIn=tf.constant(10.)
emitX=tf.constant([3.])
emitY=tf.constant([4.])
emitZ=tf.constant([5.])
numPart=tf.constant(1000.)
def Tmp(emitX,emitY,emitZ):
Werights=tf.Variable(tf.eye(6))
return Weights
with tf.Session() as sess:
sess.run(Tmp(emitX,emitY,emitZ))
In [ ]:
In [ ]: