提交 845bd561 authored 作者: Frederic Bastien's avatar Frederic Bastien

backport to python 2.4

上级 a67a4849
...@@ -65,7 +65,10 @@ class NeighbourhoodsFromImages(Op): ...@@ -65,7 +65,10 @@ class NeighbourhoodsFromImages(Op):
""" """
self.n_dims_before = n_dims_before self.n_dims_before = n_dims_before
self.dims_neighbourhoods = dims_neighbourhoods self.dims_neighbourhoods = dims_neighbourhoods
self.strides = strides if not strides is None else dims_neighbourhoods if not strides is None:
self.strides = strides
else:
self.strides = dims_neighbourhoods
self.ignore_border = ignore_border self.ignore_border = ignore_border
self.inverse = inverse self.inverse = inverse
......
...@@ -144,8 +144,10 @@ class mrg_uniform_base(Op): ...@@ -144,8 +144,10 @@ class mrg_uniform_base(Op):
def __hash__(self): def __hash__(self):
return hash(type(self)) ^ hash(self.output_type) ^ hash(self.inplace) return hash(type(self)) ^ hash(self.output_type) ^ hash(self.inplace)
def __str__(self): def __str__(self):
return self.__class__.__name__+"{%s,%s}"%(self.output_type, if self.inplace:
"inplace" if self.inplace else "no_inplace") s = "inplace"
else: s = "no_inplace"
return self.__class__.__name__+"{%s,%s}"%(self.output_type,s)
def make_node(self, rstate, size): def make_node(self, rstate, size):
# error checking slightly redundant here, since # error checking slightly redundant here, since
......
...@@ -7,6 +7,7 @@ import theano ...@@ -7,6 +7,7 @@ import theano
from theano import tensor as T from theano import tensor as T
from theano import tensor from theano import tensor
from theano import gof from theano import gof
from theano.gof.python25 import all
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
from theano import printing, pprint from theano import printing, pprint
from theano.tensor.nnet import (categorical_crossentropy, from theano.tensor.nnet import (categorical_crossentropy,
...@@ -928,7 +929,7 @@ def test_asymptotic_32(): ...@@ -928,7 +929,7 @@ def test_asymptotic_32():
assert gxval[0,1] == 0.25 assert gxval[0,1] == 0.25
class Test_softmax_opt(): class Test_softmax_opt:
# Test that expressions of softmax in terms of exponentiated things divided by row sums # Test that expressions of softmax in terms of exponentiated things divided by row sums
# are replaced by softmax expressions. # are replaced by softmax expressions.
......
...@@ -77,7 +77,10 @@ class multiple_outputs_numeric_grad: ...@@ -77,7 +77,10 @@ class multiple_outputs_numeric_grad:
for i in xrange(len(pt)): for i in xrange(len(pt)):
if ndarray_mask[i]: if ndarray_mask[i]:
# It is a ndarray that we can tweak # It is a ndarray that we can tweak
_eps = eps if eps else dtype_eps if eps:
_eps = eps
else:
_eps = dtype_eps
if pt[i].ndim : if pt[i].ndim :
_g = [] _g = []
# it has several dimensions: # it has several dimensions:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论