提交 d3496971 authored 作者: Olivier Delalleau's avatar Olivier Delalleau 提交者: Frederic

Removed tabs from doc files

上级 876944c7
...@@ -416,9 +416,9 @@ The preceding elements are featured in this more realistic example. It will be ...@@ -416,9 +416,9 @@ The preceding elements are featured in this more realistic example. It will be
prediction = p_1 > 0.5 # The prediction thresholded prediction = p_1 > 0.5 # The prediction thresholded
xent = -y*T.log(p_1) - (1-y)*T.log(1-p_1) # Cross-entropy loss function xent = -y*T.log(p_1) - (1-y)*T.log(1-p_1) # Cross-entropy loss function
cost = xent.mean() + 0.01*(w**2).sum() # The cost to minimize cost = xent.mean() + 0.01*(w**2).sum() # The cost to minimize
gw,gb = T.grad(cost, [w,b]) # Compute the gradient of the cost gw,gb = T.grad(cost, [w,b]) # Compute the gradient of the cost
# (we shall return to this in a # (we shall return to this in a
# following section of this tutorial) # following section of this tutorial)
# Compile # Compile
train = theano.function( train = theano.function(
......
...@@ -68,8 +68,8 @@ Op Contract ...@@ -68,8 +68,8 @@ Op Contract
pass pass
# C implementation: [see theano web site for other functions] # C implementation: [see theano web site for other functions]
def c_code(...): def c_code(...):
# ... # ...
pass pass
# others implementation (pycuda, ...): # others implementation (pycuda, ...):
...@@ -83,7 +83,7 @@ Op Contract ...@@ -83,7 +83,7 @@ Op Contract
def grad(self, inputs, g): def grad(self, inputs, g):
pass pass
def R_op(self, inputs, eval_points): def R_op(self, inputs, eval_points):
pass pass
def infer_shape(node, (i0_shapes, ...)) def infer_shape(node, (i0_shapes, ...))
...@@ -157,7 +157,7 @@ Op Example ...@@ -157,7 +157,7 @@ Op Example
def grad(self, inputs, output_grads): def grad(self, inputs, output_grads):
return [output_grads[0] * 2] return [output_grads[0] * 2]
def R_op(self, inputs, eval_points): def R_op(self, inputs, eval_points):
# R_op can receive None as eval_points. # R_op can receive None as eval_points.
# That mean there is no diferientiable path through that input # That mean there is no diferientiable path through that input
# If this imply that you cannot compute some outputs, # If this imply that you cannot compute some outputs,
......
...@@ -69,7 +69,7 @@ CudaNdarrays. Here is an example from the file ``theano/misc/tests/test_pycuda_t ...@@ -69,7 +69,7 @@ CudaNdarrays. Here is an example from the file ``theano/misc/tests/test_pycuda_t
gb = cuda_ndarray.CudaNdarray(b) gb = cuda_ndarray.CudaNdarray(b)
dest = cuda_ndarray.CudaNdarray.zeros(a.shape) dest = cuda_ndarray.CudaNdarray.zeros(a.shape)
multiply_them(dest, ga, gb, multiply_them(dest, ga, gb,
block=(400, 1, 1), grid=(1, 1)) block=(400, 1, 1), grid=(1, 1))
assert (numpy.asarray(dest) == a * b).all() assert (numpy.asarray(dest) == a * b).all()
......
...@@ -29,7 +29,7 @@ you out. ...@@ -29,7 +29,7 @@ you out.
adding adding
examples examples
symbolic_graphs symbolic_graphs
printing_drawing printing_drawing
gradients gradients
modes modes
loading_and_saving loading_and_saving
......
...@@ -61,7 +61,7 @@ The full documentation can be found in the library: :ref:`Scan <lib_scan>`. ...@@ -61,7 +61,7 @@ The full documentation can be found in the library: :ref:`Scan <lib_scan>`.
import numpy import numpy
import theano import theano
import theano.tensor as T import theano.tensor as T
theano.config.warn.subtensor_merge_bug = False theano.config.warn.subtensor_merge_bug = False
coefficients = theano.tensor.vector("coefficients") coefficients = theano.tensor.vector("coefficients")
x = T.scalar("x") x = T.scalar("x")
......
...@@ -83,14 +83,14 @@ Consider the logistic regression: ...@@ -83,14 +83,14 @@ Consider the logistic regression:
name = "predict") name = "predict")
if any([x.op.__class__.__name__ in ['Gemv', 'CGemv', 'Gemm', 'CGemm'] for x in if any([x.op.__class__.__name__ in ['Gemv', 'CGemv', 'Gemm', 'CGemm'] for x in
train.maker.fgraph.toposort()]): train.maker.fgraph.toposort()]):
print 'Used the cpu' print 'Used the cpu'
elif any([x.op.__class__.__name__ in ['GpuGemm', 'GpuGemv'] for x in elif any([x.op.__class__.__name__ in ['GpuGemm', 'GpuGemv'] for x in
train.maker.fgraph.toposort()]): train.maker.fgraph.toposort()]):
print 'Used the gpu' print 'Used the gpu'
else: else:
print 'ERROR, not able to tell if theano used the cpu or the gpu' print 'ERROR, not able to tell if theano used the cpu or the gpu'
print train.maker.fgraph.toposort() print train.maker.fgraph.toposort()
for i in range(training_steps): for i in range(training_steps):
pred, err = train(D[0], D[1]) pred, err = train(D[0], D[1])
......
...@@ -44,7 +44,7 @@ file and run it. ...@@ -44,7 +44,7 @@ file and run it.
rng = numpy.random.RandomState(22) rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX)) x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], T.exp(x)) f = function([], T.exp(x))
print f.maker.fgraph.toposort() print f.maker.fgraph.toposort()
t0 = time.time() t0 = time.time()
for i in xrange(iters): for i in xrange(iters):
r = f() r = f()
...@@ -339,14 +339,14 @@ Consider again the logistic regression: ...@@ -339,14 +339,14 @@ Consider again the logistic regression:
name = "predict") name = "predict")
if any([x.op.__class__.__name__ in ['Gemv', 'CGemv', 'Gemm', 'CGemm'] for x in if any([x.op.__class__.__name__ in ['Gemv', 'CGemv', 'Gemm', 'CGemm'] for x in
train.maker.fgraph.toposort()]): train.maker.fgraph.toposort()]):
print 'Used the cpu' print 'Used the cpu'
elif any([x.op.__class__.__name__ in ['GpuGemm', 'GpuGemv'] for x in elif any([x.op.__class__.__name__ in ['GpuGemm', 'GpuGemv'] for x in
train.maker.fgraph.toposort()]): train.maker.fgraph.toposort()]):
print 'Used the gpu' print 'Used the gpu'
else: else:
print 'ERROR, not able to tell if theano used the cpu or the gpu' print 'ERROR, not able to tell if theano used the cpu or the gpu'
print train.maker.fgraph.toposort() print train.maker.fgraph.toposort()
for i in range(training_steps): for i in range(training_steps):
pred, err = train(D[0], D[1]) pred, err = train(D[0], D[1])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论