tensorflow_state.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:quantum-optimal-control 作者: SchusterLab 项目源码 文件源码
def init_tf_ops_weight(self):

        #tf weights of operators

        self.H0_weight = tf.Variable(tf.ones([self.sys_para.steps]), trainable=False) #Just a vector of ones needed for the kernel
        self.weights_unpacked=[self.H0_weight] #will collect all weights here
        self.ops_weight_base = tf.Variable(tf.constant(self.sys_para.ops_weight_base, dtype = tf.float32), dtype=tf.float32,name ="weights_base")

        self.ops_weight = tf.sin(self.ops_weight_base,name="weights")
        for ii in range (self.sys_para.ops_len):
            self.weights_unpacked.append(self.sys_para.ops_max_amp[ii]*self.ops_weight[ii,:])

        #print len(self.sys_para.ops_max_amp)
        self.H_weights = tf.stack(self.weights_unpacked,name="packed_weights")



        print "Operators weight initialized."
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号