提交 bc3bd4ee authored 作者: David Warde-Farley's avatar David Warde-Farley

Whitespace cleanup.

上级 1569a7a9
......@@ -109,7 +109,7 @@ class Conv3D(theano.Op):
dCdV.name = 'Conv3D_dCdV.dCdH='+dCdH_name+',V='+V_name
dCdW.name = 'Conv3D_dCdW.dCdH='+dCdH_name+',V='+V_name+',W='+W_name
dCdb.name = 'Conv3D_dCdb.dCdH='+dCdH_name+',V='+V_name+',W='+W_name+',b='+b_name
return [ dCdV, dCdW, dCdb, dCdd ]
......@@ -140,7 +140,7 @@ class Conv3D(theano.Op):
output_dur = T.floor( (vidDur - filterDur) / dt ) +1
rval = (batch_size, output_height, output_width, output_dur, output_channels )
return [ rval ]
......
......@@ -73,7 +73,7 @@ class ConvTransp3D(theano.Op):
else:
b_name = 'anon'
dCdW.name = 'ConvTransp3D_dCdW.H='+H_name+',dCdR='+dCdR_name+',W='+W_name
dCdb.name = 'ConvTransp3D_dCdb.H='+H_name+',dCdR='+dCdR_name+',W='+W_name+',b='+b_name
dCdH.name = 'ConvTransp3D_dCdH.H='+H_name+',dCdR='+dCdR_name
......
......@@ -25,7 +25,7 @@ class ScalarSigmoid(scalar.UnaryScalarOp):
if x < -30.0:
return 0.0
if x > 30.0:
return 1.0
return 1.0
return 1.0 / (1.0 + numpy.exp(-x))
def impl(self, x):
return ScalarSigmoid.st_impl(x)
......@@ -125,7 +125,7 @@ def _is_1(expr):
return False
log1msigm_to_softplus = gof.PatternSub(
(tensor.log,
(tensor.log,
(tensor.sub,
dict(pattern='y', constraint = _is_1),
(sigmoid, 'x'))),
......@@ -134,7 +134,7 @@ log1msigm_to_softplus = gof.PatternSub(
skip_identities_fn=_skip_mul_1)
log1pexp_to_softplus = gof.PatternSub(
(tensor.log1p,
(tensor.log1p,
(tensor.exp, 'x')),
(softplus, 'x'),
allow_multiple_clients = True)
......@@ -289,7 +289,7 @@ def local_sigm_times_exp(node):
rval = tensor.mul(*terms)
else:
rval = terms[0]
if neg:
return [-rval]
else:
......@@ -336,13 +336,13 @@ def local_1msigmoid(node):
return [sigmoid(-sub_r.owner.inputs[0])]
register_local_1msigmoid = False
# This is False because the Stabilize pattern above
# is looking for 1-sigm. Also Canonizer turns neg into *(-1) and so
# This is False because the Stabilize pattern above
# is looking for 1-sigm. Also Canonizer turns neg into *(-1) and so
# this optimization might set off an unwanted chain of things.
# OTH - this transformation can be seen as pushing normal arithmetic either below or above the
# sigmoidal nonlinearity... so if the canonicalized form had anything to say about that then it
# would be a consideration... anyway leaving False for now.
if register_local_1msigmoid:
opt.register_canonicalize(local_1msigmoid)
......
......@@ -155,7 +155,7 @@ class RandomFunction(gof.Op):
raise TypeError('r must be RandomStateType instance', r)
# the following doesn't work because we want to ignore the broadcastable flags in
# shape.type
# assert shape.type == tensor.lvector
# assert shape.type == tensor.lvector
# convert args to TensorType instances
# and append enough None's to match the length of self.args
......
""" Ops for downsampling images.
Planned:
Planned:
DownsampleFactorMax, DownsampleAvg, DownsampleSoftmax.
"""
......@@ -21,7 +21,7 @@ def max_pool_2d(input, ds, ignore_border=False):
the specified factor, by keeping only the maximum value of non-overlapping
patches of size (ds[0],ds[1])
:type input: N-D theano tensor of input images.
:type input: N-D theano tensor of input images.
:param input: input images. Max pooling will be done over the 2 last dimensions.
:type ds: tuple of length 2
:param ds: factor by which to downscale. (2,2) will halve the image in each dimension.
......@@ -39,7 +39,7 @@ def max_pool_2d(input, ds, ignore_border=False):
batch_size = tensor.shape_padright(batch_size,1)
# store as 4D tensor with shape: (batch_size,1,height,width)
new_shape = tensor.cast(tensor.join(0, batch_size,
new_shape = tensor.cast(tensor.join(0, batch_size,
tensor.as_tensor([1,]), img_shape), 'int64')
input_4D = tensor.reshape(input, new_shape, ndim=4)
......@@ -54,7 +54,7 @@ def max_pool_2d(input, ds, ignore_border=False):
class DownsampleFactorMax(Op):
"""
For N-dimensional tensors, consider that the last two dimensions span images.
For N-dimensional tensors, consider that the last two dimensions span images.
This Op downsamples these images by a factor ds, by taking the max over non-
overlapping rectangular regions.
"""
......@@ -77,7 +77,7 @@ class DownsampleFactorMax(Op):
:rtype: list
:returns: the shape of the output from this op, for input of given shape. This will
have the same length as imgshape, but with last two elements reduced as per the
downsampling & ignore_border flags.
downsampling & ignore_border flags.
"""
if len(imgshape) < 2:
raise TypeError('imgshape must have at least two elements (rows, cols)')
......@@ -162,7 +162,7 @@ class DownsampleFactorMax(Op):
int x_shp0_usable;
int x_shp1_usable;
int z_shp0, z_shp1;
if(%(x)s->nd!=4)
if(%(x)s->nd!=4)
{
PyErr_SetString(PyExc_ValueError, "x must be a 4d ndarray");
%(fail)s;
......@@ -289,17 +289,17 @@ class DownsampleFactorMaxGrad(Op):
PyErr_SetString(PyExc_ValueError, "input types must all match");
%(fail)s;
}
if(%(x)s->nd!=4)
if(%(x)s->nd!=4)
{
PyErr_SetString(PyExc_ValueError, "x must be a 4d ndarray");
%(fail)s;
}
if(%(z)s->nd!=4)
if(%(z)s->nd!=4)
{
PyErr_SetString(PyExc_ValueError, "z must be a 4d ndarray");
%(fail)s;
}
if(%(gz)s->nd!=4)
if(%(gz)s->nd!=4)
{
PyErr_SetString(PyExc_ValueError, "gz must be a 4d ndarray");
%(fail)s;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论