提交 2face1be authored 作者: Ian Goodfellow's avatar Ian Goodfellow

added some connection_pattern methods

上级 fdd293db
...@@ -782,6 +782,9 @@ class CSM(gof.Op): ...@@ -782,6 +782,9 @@ class CSM(gof.Op):
indptr.copy()), shape.copy(), indptr.copy()), shape.copy(),
copy=False) copy=False)
def connection_pattern(self, node):
return [[True],[False],[False],[False]]
def grad(self, (x_data, x_indices, x_indptr, x_shape), (g_out,)): def grad(self, (x_data, x_indices, x_indptr, x_shape), (g_out,)):
g_data, g_indices, g_indptr, g_shape = csm_properties(g_out) g_data, g_indices, g_indptr, g_shape = csm_properties(g_out)
# unpack the data vector and wrap it as a 1d TensorType # unpack the data vector and wrap it as a 1d TensorType
......
...@@ -712,6 +712,12 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op): ...@@ -712,6 +712,12 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
am_shp = idx_shp am_shp = idx_shp
return [nll_shp, sm_shp, am_shp] return [nll_shp, sm_shp, am_shp]
def connection_pattern(self, node):
return [[True,True,True],#x
[True,True,True],#b
[True,True,False]]#y_idx
def grad(self, inp, grads): def grad(self, inp, grads):
x, b, y_idx = inp x, b, y_idx = inp
g_nll, g_sm, g_am = grads g_nll, g_sm, g_am = grads
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论