@@ -183,20 +183,21 @@ class Minibatch(tt.TensorVariable):
183
183
>>> minibatch = shared[ridx]
184
184
185
185
That's done. Next you can use this minibatch somewhere else.
186
- You can see that in implementation minibatch does not require
187
- fixed shape for shared variable. Feel free to use that if needed.
186
+ You can see that implementation does not require fixed shape
187
+ for shared variable. Feel free to use that if needed.
188
188
189
- So if you'll need some replacements in the graph, e.g. change it to testdata
189
+ Suppose you need some replacements in the graph, e.g. change minibatch to testdata
190
+ >>> node = x ** 2 # arbitrary expressions on minibatch `x`
190
191
>>> testdata = pm.floatX(np.random.laplace(size=(1000, 10)))
191
192
192
- You can change minibatch with static data you can create a dict with replacements
193
+ Then you should create a dict with replacements
193
194
>>> replacements = {x: testdata}
194
- >>> node = x ** 2 # arbitrary expressions
195
195
>>> rnode = theano.clone(node, replacements)
196
196
>>> assert (testdata ** 2 == rnode.eval()).all()
197
197
198
- To replace minibatch with it's shared variable
199
- instead of static :class:`ndarray` you should do
198
+ To replace minibatch with it's shared variable you should do
199
+ the same things. Minibatch variable is accessible as an attribute
200
+ as well as shared, associated with minibatch
200
201
>>> replacements = {x.minibatch: x.shared}
201
202
>>> rnode = theano.clone(node, replacements)
202
203
0 commit comments