code: def _apply_categorical_projection_naive(y, y_probs, z):
      """Naively implemented categorical projection for checking results.
  
      See (7) in https://arxiv.org/abs/1802.08163.
      """
      batch_size, n_atoms = y.shape
      assert z.shape == (n_atoms,)
      assert y_probs.shape == (batch_size, n_atoms)
      v_min = z[0]
      v_max = z[-1]
      proj_probs = np.zeros((batch_size, n_atoms), dtype=np.float32)
      for b in range(batch_size):
          for i in range(n_atoms):
              yi = y[b, i]
              p = y_probs[b, i]
              if yi <= v_min:
                  proj_probs[b, 0] += p
              elif yi > v_max:
                  proj_probs[b, -1] += p
              else:
                  for j in range(n_atoms - 1):
                      if z[j] < yi <= z[j + 1]:
                          delta_z = z[j + 1] - z[j]
                          proj_probs[b, j] += (
                              (z[j + 1] - yi) / delta_z * p
                          )
                          proj_probs[b, j + 1] += (
                              (yi - z[j]) / delta_z * p
                          )
                          break
                  else:
                      assert False
      return proj_probs
  
imports: import unittest
  import basetest_dqn_like
  import numpy
  import pytest
  import torch
  from basetest_training import _TestBatchTrainingMixin
  import pfrl
  from pfrl.agents import CategoricalDQN, categorical_dqn
  from pfrl.agents.categorical_dqn import compute_value_loss, compute_weighted_value_loss
label_desc: Use image node_id 1 for calling a global function with example usage: _apply_categorical_projection_naive(y, y_probs, z) and returns: proj_probs