code: def setUp(self):
      nodes = {
          "c": {
              "STATES": ["Present", "Absent"],
              "DESCRIPTION": "(c) Brain Tumor",
              "YPOS": "11935",
              "XPOS": "15250",
              "TYPE": "discrete",
          },
          "a": {
              "STATES": ["Present", "Absent"],
              "DESCRIPTION": "(a) Metastatic Cancer",
              "YPOS": "10465",
              "XPOS": "13495",
              "TYPE": "discrete",
          },
          "b": {
              "STATES": ["Present", "Absent"],
              "DESCRIPTION": "(b) Serum Calcium Increase",
              "YPOS": "11965",
              "XPOS": "11290",
              "TYPE": "discrete",
          },
          "e": {
              "STATES": ["Present", "Absent"],
              "DESCRIPTION": "(e) Papilledema",
              "YPOS": "13240",
              "XPOS": "17305",
              "TYPE": "discrete",
          },
          "f": {
              "STATES": ["Present", "Absent"],
              "DESCRIPTION": "(f) Asthma",
              "YPOS": "10489",
              "XPOS": "13440",
              "TYPE": "discrete",
          },
          "d": {
              "STATES": ["Present", "Absent"],
              "DESCRIPTION": "(d) Coma",
              "YPOS": "12985",
              "XPOS": "13960",
              "TYPE": "discrete",
          },
      }
      model = BayesianNetwork()
      model.add_nodes_from(["a", "b", "c", "d", "e", "f"])
      model.add_edges_from(
          [("b", "d"), ("a", "b"), ("a", "c"), ("c", "d"), ("c", "e")]
      )
      cpd_distribution = {
          "a": {"TYPE": "discrete", "DPIS": np.array([[0.2], [0.8]])},
          "e": {
              "TYPE": "discrete",
              "DPIS": np.array([[0.8, 0.6], [0.2, 0.4]]),
              "CONDSET": ["c"],
              "CARDINALITY": [2],
          },
          "f": {"TYPE": "discrete", "DPIS": np.array([[0.3], [0.7]])},
          "b": {
              "TYPE": "discrete",
              "DPIS": np.array([[0.8, 0.2], [0.2, 0.8]]),
              "CONDSET": ["a"],
              "CARDINALITY": [2],
          },
          "c": {
              "TYPE": "discrete",
              "DPIS": np.array([[0.2, 0.05], [0.8, 0.95]]),
              "CONDSET": ["a"],
              "CARDINALITY": [2],
          },
          "d": {
              "TYPE": "discrete",
              "DPIS": np.array(
                  [[0.8, 0.9, 0.7, 0.05], [0.2, 0.1, 0.3, 0.95]]
              ),
              "CONDSET": ["b", "c"],
              "CARDINALITY": [2, 2],
          },
      }
  
      tabular_cpds = []
      for var, values in cpd_distribution.items():
          evidence = values["CONDSET"] if "CONDSET" in values else []
          cpd = values["DPIS"]
          evidence_card = (
              values["CARDINALITY"] if "CARDINALITY" in values else []
          )
          states = nodes[var]["STATES"]
          cpd = TabularCPD(
              var,
              len(states),
              cpd,
              evidence=evidence,
              evidence_card=evidence_card,
          )
          tabular_cpds.append(cpd)
      model.add_cpds(*tabular_cpds)
  
      if nx.__version__.startswith("1"):
          for var, properties in nodes.items():
              model.nodes[var] = properties
      else:
          for var, properties in nodes.items():
              model._node[var] = properties
  
      self.maxDiff = None
      self.writer = XMLBeliefNetwork.XBNWriter(model=model)
  
imports: import io
  import sys
  import unittest
  import xml.etree.ElementTree
  import networkx
  import numpy
  import numpy.testing
  from pgmpy.factors.discrete import TabularCPD
  from pgmpy.models import BayesianNetwork
  from pgmpy.readwrite import XMLBeliefNetwork
label_desc: Use image node_id 1 for calling the TestXBNWriterTorch obj's underlying member method code with example usage: obj.setUp() without return types