提交 0eee9768 authored 作者: Frederic Bastien's avatar Frederic Bastien

added comment

上级 3b57cbf3
...@@ -438,6 +438,18 @@ using namespace std; ...@@ -438,6 +438,18 @@ using namespace std;
def convolve2(kerns, kshp, nkern, images, imshp, bsize, step=(1,1), def convolve2(kerns, kshp, nkern, images, imshp, bsize, step=(1,1),
bias=None, mode='valid', **d): bias=None, mode='valid', **d):
"""
param kerns: kernel tensor
param kshp: tuple(kern row, kern wid)
param nkern: int the number of kernel
param images:image tensor
param imshp: tuple([stack size,] image row, image wid)
param bsize: batch size
param step: subsampling to apply to the output tuple(row, wid)
param bias: if True, will add a bias
param mode: 'valid' or 'full'
return: tuple(theano graph with the output of ConvOp flattened to 2 dimensions, ?)
"""
#TODO: remove the bias argument from this function because convolution has nothing to do with a bias #TODO: remove the bias argument from this function because convolution has nothing to do with a bias
# if imshp, is a tuple, images contains one input dimension # if imshp, is a tuple, images contains one input dimension
...@@ -461,7 +473,6 @@ def convolve2(kerns, kshp, nkern, images, imshp, bsize, step=(1,1), ...@@ -461,7 +473,6 @@ def convolve2(kerns, kshp, nkern, images, imshp, bsize, step=(1,1),
rval = tensor.flatten(convout, 2) rval = tensor.flatten(convout, 2)
return rval, N.hstack((nkern, convop.outshp)) return rval, N.hstack((nkern, convop.outshp))
_conv_op_code_a = """ _conv_op_code_a = """
const int mode=%(mode)s; const int mode=%(mode)s;
int typenum=0, typenum_f=0; int typenum=0, typenum_f=0;
......
...@@ -2882,13 +2882,18 @@ def verify_grad(op, pt, n_tests=2, rng=None, eps=None, tol=None, mode=None, cast ...@@ -2882,13 +2882,18 @@ def verify_grad(op, pt, n_tests=2, rng=None, eps=None, tol=None, mode=None, cast
the given tolerance. the given tolerance.
:param op: something that behaves like an Op instance with a single output :param op: something that behaves like an Op instance with a single output
(can be a python function combining multiple ops) (can be a python function combining multiple ops, but see note below)
:param pt: the list of numpy.ndarrays to use as inputs to the op :param pt: the list of numpy.ndarrays to use as inputs to the op
:param n_tests: number of times to run the test :param n_tests: number of times to run the test
:param rng: random number generator from which to draw random samples :param rng: random number generator from which to draw random samples
:param eps: stepsize used in the Finite Difference Method (Default None is type-dependent) :param eps: stepsize used in the Finite Difference Method (Default None is type-dependent)
:param tol: relative tolerance used as threshold for gradient comparison :param tol: relative tolerance used as threshold for gradient comparison
:note: WARNING to unit-test writers: if `op` is a function that builds a graph,
try to make it a SMALL graph. Often verify grad is run in
debug mode, which can be very slow if it has to verify a lot
of intermediate computations.
""" """
pt = [numpy.array(p) for p in pt] pt = [numpy.array(p) for p in pt]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论