theano tutorial(三)

本文深入探讨了Theano的图结构,引用了ycheng_sjtu的Theano学习笔记(三),详细阐述了如何理解和使用Theano的计算图。
摘要由CSDN通过智能技术生成

theano的图结构,参见这篇文章ycheng_sjtu: Theano学习笔记(三)——图结构

#coding=utf-8

"""
在theano graphs之间复制随机状态

1.在两个图之间可以转换随机发生器的所有状态,(eg.用第一个graph里面发生器的状态去初始化第二个发生器里面图)
2.theano.tensor.shared_randomstreams.RandomStreams和theano.sandbox.rng_mrg.MRG_RandomStreams
3.每当从RandomStreams获得一个随机变量,就在state_updates list里面加入一个元组,元组的第一个element是一个shared变量,代表于这个特定变量的随机数所联系发生器的状态,第二个代表了相对于这个随机数产生过程的那个theano graph(即RandomFunction{Uniform,0})
"""

from __future__ import print_function
import theano
import numpy
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
from theano.tensor.shared_randomstreams import RandomStreams

class Graph():
     def __init__(self, seed=123):
         self.rng = RandomStreams(seed)
         self.y &#
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值