提交 1de9b60a 编写于 作者: X xuezhong

pass layer test

test=develop
上级 4921c2cd
...@@ -5878,7 +5878,7 @@ def sampled_softmax_with_cross_entropy(logits, ...@@ -5878,7 +5878,7 @@ def sampled_softmax_with_cross_entropy(logits,
'ignore_index': False, 'ignore_index': False,
'numeric_stable_mode': False 'numeric_stable_mode': False
}) })
return outputs / num_true return loss / num_true
def smooth_l1(x, y, inside_weight=None, outside_weight=None, sigma=None): def smooth_l1(x, y, inside_weight=None, outside_weight=None, sigma=None):
......
...@@ -378,9 +378,10 @@ class TestBook(unittest.TestCase): ...@@ -378,9 +378,10 @@ class TestBook(unittest.TestCase):
program = Program() program = Program()
with program_guard(program): with program_guard(program):
logits = layers.data(name='Logits', shape=[256], dtype='float64') logits = layers.data(name='Logits', shape=[256], dtype='float64')
label = layers.data(name='Label', shape=[5], dtype='int64') label = layers.data(name='Label', shape=[1], dtype='int64')
num_samples = 25 num_samples = 25
output = layers.sample_logits(logits, label, num_samples) output = layers.sampled_softmax_with_cross_entropy(logits, label,
num_samples)
self.assertIsNotNone(output) self.assertIsNotNone(output)
print(str(program)) print(str(program))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册