提交 b3cbf591 authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #6250 from bordesf/DeprecatedWarningSoftmax

Add deprecation warning for the softmax and logsoftmax vector case
......@@ -429,6 +429,10 @@ class Softmax(gof.Op):
raise ValueError('x must be 1-d or 2-d tensor of floats. Got %s' %
x.type)
if x.ndim == 1:
warnings.warn("DEPRECATION: If x is a vector, Softmax will not automatically pad x "
"anymore in next releases. If you need it, please do it manually. The "
"vector case is gonna be supported soon and the output will be a vector.",
stacklevel=4)
x = tensor.shape_padleft(x, n_ones=1)
return Apply(self, [x], [x.type()])
......@@ -613,6 +617,10 @@ class LogSoftmax(gof.Op):
raise ValueError('x must be 1-d or 2-d tensor of floats. Got %s' %
x.type)
if x.ndim == 1:
warnings.warn("DEPRECATION: If x is a vector, LogSoftmax will not automatically pad x "
"anymore in next releases. If you need it, please do it manually. The "
"vector case is gonna be supported soon and the output will be a vector.",
stacklevel=4)
x = tensor.shape_padleft(x, n_ones=1)
return Apply(self, [x], [x.type()])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论