提交 60bfcb8b 编写于 作者: C ceci3

test=develop, change import

上级 7ea5990c
...@@ -32,6 +32,8 @@ from .. import unique_name ...@@ -32,6 +32,8 @@ from .. import unique_name
from functools import reduce from functools import reduce
from .. import core from .. import core
from ..imperative import layers from ..imperative import layers
from .control_flow import equal
from .ops import square
__all__ = [ __all__ = [
'fc', 'fc',
...@@ -10691,9 +10693,6 @@ def npair_loss(anchor, positive, labels, l2_reg=0.002): ...@@ -10691,9 +10693,6 @@ def npair_loss(anchor, positive, labels, l2_reg=0.002):
labels = reshape(labels, shape=[batch_size, 1], inplace=True) labels = reshape(labels, shape=[batch_size, 1], inplace=True)
labels = expand(labels, expand_times=[1, batch_size]) labels = expand(labels, expand_times=[1, batch_size])
from .control_flow import equal
from .ops import square
labels = equal(labels, transpose(labels, perm=[1, 0])).astype('float32') labels = equal(labels, transpose(labels, perm=[1, 0])).astype('float32')
labels = labels / reduce_sum(labels, dim=1, keep_dim=True) labels = labels / reduce_sum(labels, dim=1, keep_dim=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册