提交 6f2a1b03 authored 作者: Frederic Bastien's avatar Frederic Bastien

add detail to comment and coding style change.

上级 d21d8bd2
...@@ -51,10 +51,10 @@ class Conv3D(theano.Op): ...@@ -51,10 +51,10 @@ class Conv3D(theano.Op):
def make_node(self, V, W, b, d): def make_node(self, V, W, b, d):
""" """
:param V: Visible unit, input :param V: Visible unit, input(batch,row,column,time,in channel)
:param W: Weights, filter :param W: Weights, filter(out channel,row,column,time,in channel)
:param b: bias, shape == (W.shape[0],) :param b: bias, shape == (W.shape[0],)
:param d: strides when moving the filter over the input :param d: strides when moving the filter over the input(dx,dy,dt)
""" """
V_ = T.as_tensor_variable(V) V_ = T.as_tensor_variable(V)
...@@ -82,22 +82,22 @@ class Conv3D(theano.Op): ...@@ -82,22 +82,22 @@ class Conv3D(theano.Op):
dCdb = T.sum(dCdH, axis=(0,1,2,3)) dCdb = T.sum(dCdH, axis=(0,1,2,3))
dCdd = None #not differentiable, since d is not continuous dCdd = None #not differentiable, since d is not continuous
if 'name' in dir(dCdH) and dCdH.name != None: if 'name' in dir(dCdH) and dCdH.name is not None:
dCdH_name = dCdH.name dCdH_name = dCdH.name
else: else:
dCdH_name = 'anon' dCdH_name = 'anon'
if 'name' in dir(V) and V.name != None: if 'name' in dir(V) and V.name is not None:
V_name = V.name V_name = V.name
else: else:
V_name = 'anon' V_name = 'anon'
if 'name' in dir(W) and W.name != None: if 'name' in dir(W) and W.name is not None:
W_name = W.name W_name = W.name
else: else:
W_name = 'anon' W_name = 'anon'
if 'name' in dir(b) and b.name != None: if 'name' in dir(b) and b.name is not None:
b_name = b.name b_name = b.name
else: else:
b_name = 'anon' b_name = 'anon'
......
...@@ -50,22 +50,22 @@ class ConvTransp3D(theano.Op): ...@@ -50,22 +50,22 @@ class ConvTransp3D(theano.Op):
dCdRShape = None #not differentiable, since RShape is not continuous dCdRShape = None #not differentiable, since RShape is not continuous
if 'name' in dir(dCdR) and dCdR.name != None: if 'name' in dir(dCdR) and dCdR.name is not None:
dCdR_name = dCdR.name dCdR_name = dCdR.name
else: else:
dCdR_name = 'anon' dCdR_name = 'anon'
if 'name' in dir(H) and H.name != None: if 'name' in dir(H) and H.name is not None:
H_name = H.name H_name = H.name
else: else:
H_name = 'anon' H_name = 'anon'
if 'name' in dir(W) and W.name != None: if 'name' in dir(W) and W.name is not None:
W_name = W.name W_name = W.name
else: else:
W_name = 'anon' W_name = 'anon'
if 'name' in dir(b) and b.name != None: if 'name' in dir(b) and b.name is not None:
b_name = b.name b_name = b.name
else: else:
b_name = 'anon' b_name = 'anon'
...@@ -79,9 +79,9 @@ class ConvTransp3D(theano.Op): ...@@ -79,9 +79,9 @@ class ConvTransp3D(theano.Op):
def perform(self, node, inputs, output_storage): def perform(self, node, inputs, output_storage):
W, b, d, H, RShape = inputs W, b, d, H, RShape = inputs
print "\t\t\t\tConvTransp3D python code" print "\t\t\t\tConvTransp3D python code"
output_storage[0][0] = computeR(W,b,d,H,RShape) output_storage[0][0] = computeR(W,b,d,H,RShape)
def c_code(self, node, nodename, (W, b, d, H, RShape), outputs, sub): def c_code(self, node, nodename, (W, b, d, H, RShape), outputs, sub):
fail = sub['fail'] fail = sub['fail']
...@@ -360,7 +360,7 @@ def computeR(W,b,d,H,Rshape = None): ...@@ -360,7 +360,7 @@ def computeR(W,b,d,H,Rshape = None):
videoWidth = (outputWidth-1) * dc + filterWidth videoWidth = (outputWidth-1) * dc + filterWidth
videoDur = (outputDur-1) * dt + filterDur videoDur = (outputDur-1) * dt + filterDur
if Rshape != None and Rshape[0] != -1: if Rshape is not None and Rshape[0] != -1:
if Rshape[0] < videoHeight: if Rshape[0] < videoHeight:
print (Rshape[0], videoHeight) print (Rshape[0], videoHeight)
assert False assert False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论