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

backport to python 2.4

上级 a67a4849
......@@ -65,7 +65,10 @@ class NeighbourhoodsFromImages(Op):
"""
self.n_dims_before = n_dims_before
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.inverse = inverse
......
......@@ -144,8 +144,10 @@ class mrg_uniform_base(Op):
def __hash__(self):
return hash(type(self)) ^ hash(self.output_type) ^ hash(self.inplace)
def __str__(self):
return self.__class__.__name__+"{%s,%s}"%(self.output_type,
"inplace" if self.inplace else "no_inplace")
if self.inplace:
s = "inplace"
else: s = "no_inplace"
return self.__class__.__name__+"{%s,%s}"%(self.output_type,s)
def make_node(self, rstate, size):
# error checking slightly redundant here, since
......
......@@ -7,6 +7,7 @@ import theano
from theano import tensor as T
from theano import tensor
from theano import gof
from theano.gof.python25 import all
from theano.tests import unittest_tools as utt
from theano import printing, pprint
from theano.tensor.nnet import (categorical_crossentropy,
......@@ -928,7 +929,7 @@ def test_asymptotic_32():
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
# are replaced by softmax expressions.
......
......@@ -77,7 +77,10 @@ class multiple_outputs_numeric_grad:
for i in xrange(len(pt)):
if ndarray_mask[i]:
# 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 :
_g = []
# it has several dimensions:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论