code: def test_word2vec_no_nce(self):
      batch_size = 8
      embedding_size = 50
      inputs = tl.layers.Input([batch_size], dtype=tf.int32)
      emb_net = tl.layers.Word2vecEmbedding(
          vocabulary_size=10000,
          embedding_size=embedding_size,
          num_sampled=100,
          activate_nce_loss=False,  # the nce loss is activated
          nce_loss_args={},
          E_init=tl.initializers.random_uniform(
              minval=-1.0, maxval=1.0
          ),
          nce_W_init=tl.initializers.truncated_normal(
              stddev=float(1.0 / np.sqrt(embedding_size))
          ),
          nce_b_init=tl.initializers.constant(value=0.0),
      )
      print(emb_net)
      embed_tensor = emb_net(inputs)
      embed_tensor = emb_net(inputs, use_nce_loss=False)
      try:
          embed_tensor = emb_net(inputs, use_nce_loss=True)
      except AttributeError as e:
          print(e)
      self.assertEqual(
          embed_tensor.get_shape().as_list(),
          [batch_size, embedding_size],
      )
      model = tl.models.Model(inputs=inputs, outputs=embed_tensor)
  
file_path: TensorLayer/tests/layers/test_layers_embedding.py
imports: import os
  import unittest
  import numpy
  import tensorflow
  import tensorlayer
  from tests.utils import CustomTestCase
label_desc: Use image node_id 7 for calling the Layer_Embed_Test obj's underlying member method code with example usage: obj.test_word2vec_no_nce() without return types