code: def _is_diagonal(x):
      """Helper to identify if `LinearOperator` has only a diagonal component."""
      return (
          isinstance(x, tf.linalg.LinearOperatorIdentity)
          or isinstance(x, tf.linalg.LinearOperatorScaledIdentity)
          or isinstance(x, tf.linalg.LinearOperatorDiag)
      )
  
file_path: trfl/trfl/distribution_ops_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  from absl.testing import parameterized
  import tensorflow.compat.v1
  import tensorflow_probability
  from trfl import distribution_ops
label_desc: Use image node_id 1 for calling a global function with example usage: _is_diagonal(x) and returns: unknown