code: def test_simplex():
      """Test for simplex operator"""
      # 1d Tensor
      tensor = T.tensor([0.4, 0.5, 0.6])
      res = simplex_prox(tensor, 1)
      true_res = T.tensor([0.23, 0.33, 0.43])
      assert_array_almost_equal(true_res, res, decimal=2)
  
      # 2d Tensor
      tensor = T.tensor([[0.4, 1.5, 1], [0.5, 2, 3], [0.6, 0.3, 2.9]])
      res = simplex_prox(tensor, 1)
      true_res = T.tensor(
          [[0.23, 0.25, 0], [0.33, 0.75, 0.55], [0.43, 0, 0.45]]
      )
      assert_array_almost_equal(true_res, res, decimal=2)
  
imports: import numpy
  from ...None import backend
  from ..proximal import svd_thresholding, smoothness_prox, soft_thresholding, hals_nnls, fista, active_set_nnls, procrustes, hard_thresholding, soft_sparsity_prox, simplex_prox, normalized_sparsity_prox, monotonicity_prox, unimodality_prox, l2_prox, l2_square_prox, admm
  from ...testing import assert_, assert_array_equal, assert_array_almost_equal
  from tensorly import tensor_to_vec, truncated_svd
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: test_simplex() without return types