def test_embed():

    embed_dense = L.EmbedID(5, 10)
    embed_sparse = L.EmbedID(5, 10)
    embed_dense.W.data[:] = np.random.randn(5, 10).astype('float32')
    embed_sparse.W.data[:] = np.random.randn(5, 10).astype('float32')
    embed_sparse.W.data[:, 1:] /= 1e5
    dhl_dense_01 = dirichlet_likelihood(embed_dense, alpha=0.1).data
    dhl_sparse_01 = dirichlet_likelihood(embed_sparse, alpha=0.1).data

    msg = "Sparse vector has higher likelihood than dense with alpha=0.1"
    assert dhl_sparse_01 > dhl_dense_01, msg
Test that embedding is treated like a Variable
dataset/ETHPy150Open cemoody/lda2vec/tests/test_dirichlet_likelihood.py/test_embed