提交 94506569 authored 作者: abergeron's avatar abergeron

Merge pull request #1719 from nouiz/gpu_windows

Fix Gpu crash on windows
......@@ -342,7 +342,7 @@ class ProfileStats(object):
es += [' %2s ']
hs += ['<#call>']
es += [' %4d ']
es += [' %5d ']
hs += ['<#apply>']
es += [' %4d ']
......@@ -362,9 +362,12 @@ class ProfileStats(object):
continue
tot += t
ftot = tot * 100 / local_time
# Remove the useless start and end of the class name:
# "<class 'theano.sandbox.cuda.blas.GpuDot22'>" -> "theano.sandbox.cuda.blas.GpuDot22"
class_name = str(a)[8:-2][:maxlen]
print >> file, format_str % (f, ftot, t, t / nb_call,
impl, nb_call,
nb_apply, str(a)[:maxlen])
nb_apply, class_name)
# While this carries over less information, it is arranged such
# that it way more readeable that the previous output of the
# profiler
......
......@@ -644,8 +644,14 @@ class Subtensor(Op):
len_is_slice = len(is_slice)
len_subtensor_spec = spec_pos()
subensor_spec = "npy_intp subtensor_spec[%(len_subtensor_spec)s];" % locals()
if len_subtensor_spec == 0:
subensor_spec = "npy_intp * subtensor_spec = NULL;"
is_slice_init = ",".join([str(s) for s in is_slice])
if is_slice:
is_slice_init = "int is_slice[] = {" + ",".join([str(s) for s in is_slice]) + "};"
else:
is_slice_init = "int* is_slice = NULL;"
subtensor_init = "\n".join(init_cmds)
x, = inputs[:1]
......@@ -673,8 +679,8 @@ class Subtensor(Op):
// The subtensor is created by iterating over the dimensions
// and updating stride, shape, and data pointers
int is_slice[] = {%(is_slice_init)s};
npy_intp subtensor_spec[%(len_subtensor_spec)s];
%(is_slice_init)s
%(subensor_spec)s
%(subtensor_init)s;
int spec_pos = 0; //position in subtensor_spec
int inner_ii = 0; // the current dimension of zview
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论