class_docstr: Test cases for unary operators.
class_docstr_tok: ["Test","cases","for","unary","operators","."]
code: def testCastFp8(self):
      if platform.system() == "Darwin":
          # TODO(b/271327511): Fix issue where casts to FP8 very rarely result in
          # NaN on Mac
          self.skipTest("Casts to FP8 sometimes result in NaN on Mac")
      fp8_types = {dtypes.float8_e5m2, dtypes.float8_e4m3fn}
      other_types = {
          dtypes.bool,
          dtypes.float32,
          dtypes.float64,
          dtypes.complex64,
          dtypes.int32,
          dtypes.int64,
          dtypes.uint32,
          dtypes.uint64,
      }
      for fp8_type in fp8_types:
          for other_type in other_types | fp8_types:
              self._testCast(fp8_type, other_type)
              self._testCast(other_type, fp8_type)
  
imports: import platform
  import unittest
  import numpy
  import six
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.framework import dtypes
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import bitwise_ops
  from tensorflow.python.ops import gen_functional_ops
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 19 for calling the UnaryOpsTest obj's underlying member method code with example usage: obj.testCastFp8() without return types