class_docstr: Tests for nn.weighted_moments.
  
  Note that this test inherits from MomentsTest, inheriting all its
  test methods!
  
  It modifies MomentsTest in two ways:
  
  a) By overriding _unweighted_moments, all the codepaths in
     MomentsTest are executed, but with calls to tf.nn.moments()
     replaced by calls to tf.nn.weighted_moments() with a constant
     weight of 1.
  
  b) By overriding RunMomentTest and RunMomentTestWithDynamicShape,
     this test adds multiple additional calls to
     RunWeightedMomentsTest() to exercise correctness with
     non-constant weights and varying broadcasting situations. (It
     also continues to call MomentsTest.Run(Weighted)?MomentsTest as
     well.)
class_docstr_tok: ["Tests","for","nn.weighted_moments",".","Note","that","this","test","inherits","from","MomentsTest",",","inheriting","all","its","test","methods","!","It","modifies","MomentsTest","in","two","ways",":","a",")","By","overriding","_unweighted_moments",",","all","the","codepaths","in","MomentsTest","are","executed",",","but","with","calls","to","tf.nn.moments","(",")","replaced","by","calls","to","tf.nn.weighted_moments","(",")","with","a","constant","weight","of","1.","b",")","By","overriding","RunMomentTest","and","RunMomentTestWithDynamicShape",",","this","test","adds","multiple","additional","calls","to","RunWeightedMomentsTest","(",")","to","exercise","correctness","with","non-constant","weights","and","varying","broadcasting","situations",".","(","It","also","continues","to","call","MomentsTest.Run","(","Weighted",")","?","MomentsTest","as","well",".",")"]
code: def _unweighted_moments(
      self, x, axes, keep_dims=False, extra_out_grads=None
  ):
      weights = constant_op.constant(1, dtype=x.dtype)
      if extra_out_grads is not None:
          # We want to assert gradients WRT weights as well as X!
          extra_out_grads.append(weights)
      return nn_impl.weighted_moments(
          x, axes, weights, keep_dims=keep_dims
      )
  
imports: import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  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 1 for calling the WeightedMomentsTest obj's underlying member method code with example usage: obj._unweighted_moments(x, axes, keep_dims, extra_out_grads) and returns: nn_impl