提交 22aa6b41 authored 作者: James Bergstra's avatar James Bergstra

merge

上级 1be4fa4f
......@@ -583,6 +583,14 @@ class _tensor_py_operators:
def sum(self, axis=None):
return elemwise.Sum(axis)(self)
def norm(self, L, axis=None):
if L==0:
raise NotImplementedError()
if L==float('inf'):
raise NotImplementedError()
#optimizations will/should catch cases like L=1, L=2
return pow(pow(self, L).sum(axis=axis), 1.0/L)
class TensorResult(Result, _tensor_py_operators):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论