class_docstr: A sampler for continuous variables based on Hamiltonian mechanics.
  
  See NUTS sampler for automatically tuned stopping time and step size scaling.
class_docstr_tok: ["A","sampler","for","continuous","variables","based","on","Hamiltonian","mechanics",".","See","NUTS","sampler","for","automatically","tuned","stopping","time","and","step","size","scaling","."]
docstr: Check how appropriate this class is for sampling a random variable.
docstr_tok: ["Check","how","appropriate","this","class","is","for","sampling","a","random","variable","."]
code: def competence(var, has_grad):
      """Check how appropriate this class is for sampling a random variable."""
      if var.dtype in discrete_types or not has_grad:
          return Competence.INCOMPATIBLE
      return Competence.COMPATIBLE
  
file_path: pymc/pymc/step_methods/hmc/hmc.py
imports: from __future__ import annotations
  from typing import Any
  import numpy
  from pymc.stats.convergence import SamplerWarning
  from pymc.step_methods.compound import Competence
  from pymc.step_methods.hmc.base_hmc import BaseHMC, DivergenceInfo, HMCStepData
  from pymc.step_methods.hmc.integration import IntegrationError, State
  from pymc.vartypes import discrete_types
label_desc: Use image node_id 3 for calling the HamiltonianMC obj's underlying member method code with example usage: obj.competence(var, has_grad) and returns: Competence, Competence