code: def testGradient(self):
      sizes = [4, 2]
      with self.cached_session():
          logits, targets, pos_weight, _ = self._Inputs(sizes=sizes)
          loss = nn_impl.weighted_cross_entropy_with_logits(
              targets=targets, logits=logits, pos_weight=pos_weight
          )
          err = gradient_checker.compute_gradient_error(
              logits, sizes, loss, sizes
          )
      print("logistic loss gradient err = ", err)
      self.assertLess(err, 1e-7)
  
imports: import math
  import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import nn_impl
  import tensorflow.python.ops.nn_grad
  from tensorflow.python.platform import test
label_desc: Use image node_id 6 for calling the WeightedCrossEntropyTest obj's underlying member method code with example usage: obj.testGradient() without return types