code: def test_soft_thresholding():
      """Test for shrinkage"""
      # small test
      tensor = T.tensor(
          [
              [[1, 2, 3], [4.3, -1.2, 3]],
              [[0.5, -5, -1.3], [1.2, 3.7, -9]],
              [[-2, 0, 1.0], [0.5, -0.5, 1.1]],
          ]
      )
      threshold = 1.1
      copy_tensor = T.copy(tensor)
      res = soft_thresholding(tensor, threshold)
      true_res = T.tensor(
          [
              [[0, 0.9, 1.9], [3.2, -0.1, 1.9]],
              [[0, -3.9, -0.2], [0.1, 2.6, -7.9]],
              [[-0.9, 0, 0], [0, -0, 0]],
          ]
      )
      # account for floating point errors: np array have a precision of around 2e-15
      # check np.finfo(np.float64).eps
      assert_array_almost_equal(true_res, res)
      # Check that we did not change the original tensor
      assert_array_equal(copy_tensor, tensor)
  
      # Another test
      tensor = T.tensor([[1, 2, 1.5], [4, -6, -0.5], [0.2, 1.02, -3.4]])
      copy_tensor = T.copy(tensor)
      threshold = 1.1
      true_res = T.tensor([[0, 0.9, 0.4], [2.9, -4.9, 0], [0, 0, -2.3]])
      res = soft_thresholding(tensor, threshold)
      assert_array_almost_equal(true_res, res)
      assert_array_equal(copy_tensor, tensor)
  
      # Test with missing values
      tensor = T.tensor([[1, 2, 1.5], [4, -6, -0.5], [0.2, 1.02, -3.4]])
      copy_tensor = T.copy(tensor)
      mask = T.tensor([[0, 1, 1], [1, 0, 1], [1, 1, 0]])
      threshold = 1.1 * mask
      true_res = T.tensor([[1, 0.9, 0.4], [2.9, -6, 0], [0, 0, -3.4]])
      res = soft_thresholding(tensor, threshold)
      assert_array_almost_equal(true_res, res)
      assert_array_equal(copy_tensor, tensor)
  
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 10 for calling a global function with example usage: test_soft_thresholding() without return types