예제 #1
0
def test_check_embedding_lookup_3():
    m = EmbeddingLookup(vocab_size=32000,
                        embedding_size=768,
                        embedding_shape=[1, 128, 768],
                        use_one_hot_embeddings=True,
                        initializer_range=0.01)
    m(Tensor(np.ones([128]), mstype.int32))
예제 #2
0
def test_check_embedding_lookup_1():
    m = EmbeddingLookup(vocab_size=32000,
                        embedding_size=768,
                        embedding_shape=[1, 128, 768],
                        use_one_hot_embeddings=False)
    m(Tensor(np.ones([128]), mstype.int32))
예제 #3
0
     'desc_bprop': [[32000, 768]],
     'skip': ['compile', 'exec']
 }),
 ('GetMaskedLMOutput', {
     'block':
     GetMaskedLMOutput(BertConfig(batch_size=1)),
     'desc_inputs': [[1, 128, 768], [32000, 768],
                     Tensor(np.ones(shape=[20, 768]).astype(np.int32))],
     'desc_bprop': [[15360, 32000]]
 }),
 ('EmbeddingLookup_1', {
     'block':
     get_output_cell(
         EmbeddingLookup(vocab_size=32000,
                         embedding_size=768,
                         embedding_shape=[1, 128, 768],
                         use_one_hot_embeddings=False,
                         initializer_range=0.02), 1, 0),
     'desc_inputs': [input_ids],
     'desc_bprop': [[1, 128, 768]]
 }),
 ('EmbeddingLookup_2', {
     'block':
     get_output_cell(
         EmbeddingLookup(vocab_size=32000,
                         embedding_size=768,
                         embedding_shape=[1, 128, 768],
                         use_one_hot_embeddings=False,
                         initializer_range=0.02), 1, 1),
     'desc_inputs': [input_ids],
     'desc_bprop': [[128]]