code: def test_hardshrink(dtype):
      x = tf.constant([-2.0, -0.5, 0.0, 0.5, 2.0], dtype=dtype)
      expected_result = tf.constant(
          [-2.0, 0.0, 0.0, 0.0, 2.0], dtype=dtype
      )
      test_utils.assert_allclose_according_to_type(
          hardshrink(x), expected_result
      )
  
      expected_result = tf.constant(
          [-2.0, 0.0, 0.0, 0.0, 2.0], dtype=dtype
      )
      test_utils.assert_allclose_according_to_type(
          hardshrink(x, lower=-1.0, upper=1.0), expected_result
      )
  
imports: import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.activations.hardshrink import hardshrink
  from tensorflow_addons.utils import test_utils
label_desc: Use image node_id 1 for calling a global function with example usage: test_hardshrink(dtype) without return types