提交 a9dbe0d5 authored 作者: Vivek Kulkarni's avatar Vivek Kulkarni

Fixed indentation in opt.py

上级 5bfe819c
...@@ -51,17 +51,17 @@ theano.compile.optdb.register('local_inplace_remove0', ...@@ -51,17 +51,17 @@ theano.compile.optdb.register('local_inplace_remove0',
@gof.local_optimizer([None]) @gof.local_optimizer([None])
def local_inplace_addsd(node): def local_inplace_addsd(node):
""" """
Optimization to insert inplace versions of Remove0. Optimization to insert inplace versions of AddSD.
""" """
if isinstance(node.op, sparse.AddSD) and not node.op.inplace: if isinstance(node.op, sparse.AddSD) and not node.op.inplace:
inputs = node.inputs[:3] + [node.inputs[3].shape] inputs = node.inputs[:3] + [node.inputs[3].shape]
fmt = node.op.format fmt = node.op.format
if fmt == 'csc': if fmt == 'csc':
x = sparse.CSC(*inputs) x = sparse.CSC(*inputs)
elif fmt == 'csr': elif fmt == 'csr':
x = sparse.CSR(*inputs) x = sparse.CSR(*inputs)
else: else:
raise NotImplementedError('Sparse format %s is not supported' % fmt) raise NotImplementedError('Sparse format %s is not supported' % fmt)
new_op = node.op.__class__(inplace=True) new_op = node.op.__class__(inplace=True)
new_node = new_op(x, node.inputs[3]) new_node = new_op(x, node.inputs[3])
return [new_node] return [new_node]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论