code: def test_tt_vonneumann_entropy_pure_state():
      """Test for tt_vonneumann_entropy TT tensors.
      This test checks that pure states have a VNE of zero.
      """
      state = tl.randn((8, 1))
      state = state / tl.norm(state)
      mat_pure = tl.reshape(
          tl.dot(state, tl.transpose(state)), (2, 2, 2, 2, 2, 2)
      )
      mat_pure = tensor_train(mat_pure, rank=(1, 3, 2, 1, 2, 3, 1))
      tl_vne = tt_vonneumann_entropy(mat_pure)
      assert_array_almost_equal(tl_vne, 0, decimal=3)
  
file_path: tensorly/tensorly/metrics/tests/test_entropy.py
imports: import tensorly
  from ..entropy import vonneumann_entropy
  from ..entropy import tt_vonneumann_entropy, cp_vonneumann_entropy
  from ...decomposition import parafac, tensor_train
  from tensorly.testing import assert_array_almost_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_tt_vonneumann_entropy_pure_state() without return types