code: def requires_grad(tensor, interface=None):
      """Returns True if the tensor is considered trainable.
  
      .. warning::
  
          The implementation depends on the contained tensor type, and
          may be context dependent.
  
          For example, Torch tensors and PennyLane tensors track trainability
          as a property of the tensor itself. TensorFlow, on the other hand,
          only tracks trainability if being watched by a gradient tape.
  
      Args:
          tensor (tensor_like): input tensor
          interface (str): The name of the interface. Will be determined automatically
              if not provided.
  
      **Example**
  
      Calling this function on a PennyLane NumPy array:
  
      >>> x = np.array([1., 5.], requires_grad=True)
      >>> requires_grad(x)
      True
      >>> x.requires_grad = False
      >>> requires_grad(x)
      False
  
      PyTorch has similar behaviour.
  
      With TensorFlow, the output is dependent on whether the tensor
      is currently being watched by a gradient tape:
  
      >>> x = tf.Variable([0.6, 0.1])
      >>> requires_grad(x)
      False
      >>> with tf.GradientTape() as tape:
      ...     print(requires_grad(x))
      True
  
      While TensorFlow constants are by default not trainable, they can be
      manually watched by the gradient tape:
  
      >>> x = tf.constant([0.6, 0.1])
      >>> with tf.GradientTape() as tape:
      ...     print(requires_grad(x))
      False
      >>> with tf.GradientTape() as tape:
      ...     tape.watch([x])
      ...     print(requires_grad(x))
      True
      """
      interface = interface or get_interface(tensor)
  
      if interface == "tensorflow":
          import tensorflow as tf
  
          should_record_backprop = import_should_record_backprop()
          return should_record_backprop([tf.convert_to_tensor(tensor)])
  
      if interface == "autograd":
          if isinstance(tensor, ArrayBox):
              return True
  
          return getattr(tensor, "requires_grad", False)
  
      if interface == "torch":
          return getattr(tensor, "requires_grad", False)
  
      if interface in {"numpy", "scipy"}:
          return False
  
      if interface == "jax":
          import jax
  
          return isinstance(tensor, jax.core.Tracer)
  
      raise ValueError(f"Argument {tensor} is an unknown object")
  
file_path: pennylane/pennylane/math/utils.py
imports: import warnings
  import autoray
  import numpy
  from autograd.numpy.numpy_boxes import ArrayBox
  from autoray import numpy
  from .None import single_dispatch
label_desc: Use image node_id 11 for calling a global function with example usage: requires_grad(tensor, interface) and returns: should_record_backprop, getattr, getattr, False, isinstance, True