提交 3f7d0389 authored 作者: Frederic's avatar Frederic

warn about interface change.

上级 e913f6f0
...@@ -13,6 +13,9 @@ Done up to PR 1608 ...@@ -13,6 +13,9 @@ Done up to PR 1608
* https://github.com/Theano/Theano/pull/1591 # need info * https://github.com/Theano/Theano/pull/1591 # need info
Interface change:
- theano.tensor.signal.conv2d(2d,2d) output 2d answer. (Frederic B., reported by Alexander Izvorski)
Theano Development version Theano Development version
========================== ==========================
......
...@@ -400,6 +400,12 @@ AddConfigVar('warn.vm_gc_bug', ...@@ -400,6 +400,12 @@ AddConfigVar('warn.vm_gc_bug',
BoolParam(False), BoolParam(False),
in_c_key=False) in_c_key=False)
AddConfigVar('warn.signal_conv2d_interface',
("Warn we use the new signal.conv2d() when its interface"
" changed mid June 2014"),
BoolParam(warn_default('0.7')),
in_c_key=False)
AddConfigVar('compute_test_value', AddConfigVar('compute_test_value',
("If 'True', Theano will run each op at graph build time, using " ("If 'True', Theano will run each op at graph build time, using "
"Constants, SharedVariables and the tag 'test_value' as inputs " "Constants, SharedVariables and the tag 'test_value' as inputs "
......
...@@ -5,6 +5,9 @@ generic 2D convolution. ...@@ -5,6 +5,9 @@ generic 2D convolution.
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
import warnings
import theano
import theano.tensor as tensor import theano.tensor as tensor
from theano.tensor.nnet import conv from theano.tensor.nnet import conv
...@@ -83,6 +86,13 @@ def conv2d(input, filters, image_shape=None, filter_shape=None, ...@@ -83,6 +86,13 @@ def conv2d(input, filters, image_shape=None, filter_shape=None,
# flatten to 3D tensor if convolving with single filter or single image # flatten to 3D tensor if convolving with single filter or single image
if input.ndim == 2 and filters.ndim == 2: if input.ndim == 2 and filters.ndim == 2:
if theano.config.warn.signal_conv2d_interface:
warnings.warn(
"theano.tensor.signal.conv2d() now output 2d tensor when both"
" inputs are 2d. To disable this warning, set the Theano flag"
" warn.signal_conv2d_interface to False",
stacklevel=3)
output = tensor.flatten(output.T, outdim=2).T output = tensor.flatten(output.T, outdim=2).T
elif input.ndim == 2 or filters.ndim == 2: elif input.ndim == 2 or filters.ndim == 2:
output = tensor.flatten(output.T, outdim=3).T output = tensor.flatten(output.T, outdim=3).T
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论