提交 c2d3f2f6 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #1604 from bbudescu/msvc-compat

msvc9 compatibility
...@@ -627,9 +627,26 @@ class Subtensor(Op): ...@@ -627,9 +627,26 @@ class Subtensor(Op):
x, = inputs[:1] x, = inputs[:1]
z, = outputs z, = outputs
if view_ndim:
rval = """
// Argument of the view
ssize_t xview_dims[%(view_ndim)s];
ssize_t xview_strides[%(view_ndim)s];
"""% locals()
else:
rval = """
// Argument of the view
ssize_t* xview_dims = NULL;
ssize_t* xview_strides = NULL;
"""
rval = """ rval += """
// One more argument of the view
ssize_t xview_offset = 0;
// The subtensor is created by iterating over the dimensions // The subtensor is created by iterating over the dimensions
// and updating stride, shape, and data pointers // and updating stride, shape, and data pointers
...@@ -640,11 +657,7 @@ class Subtensor(Op): ...@@ -640,11 +657,7 @@ class Subtensor(Op):
int inner_ii = 0; // the current dimension of zview int inner_ii = 0; // the current dimension of zview
int outer_ii = 0; // current dimension of z int outer_ii = 0; // current dimension of z
// Argument of the view
ssize_t xview_offset = 0;
ssize_t xview_dims[%(view_ndim)s];
ssize_t xview_strides[%(view_ndim)s];
for (; outer_ii < %(len_is_slice)s; ++outer_ii) for (; outer_ii < %(len_is_slice)s; ++outer_ii)
{ {
if (is_slice[outer_ii]) if (is_slice[outer_ii])
...@@ -763,7 +776,7 @@ class Subtensor(Op): ...@@ -763,7 +776,7 @@ class Subtensor(Op):
@staticmethod @staticmethod
def helper_c_code_cache_version(): def helper_c_code_cache_version():
return (6,) return (7,)
def c_code(self, node, name, inputs, outputs, sub): # DEBUG def c_code(self, node, name, inputs, outputs, sub): # DEBUG
if not isinstance(node.inputs[0].type, theano.tensor.TensorType): if not isinstance(node.inputs[0].type, theano.tensor.TensorType):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论