code: def test_compute_eltwise_huber_quantile_loss(batch_size, N, N_prime):
      # Overestimation is penalized proportionally to 1-tau
      # Underestimation is penalized proportionally to tau
      y = torch.randn(
          batch_size, N, dtype=torch.float, requires_grad=True
      )
      t = torch.randn(batch_size, N_prime, dtype=torch.float)
      tau = torch.rand(batch_size, N, dtype=torch.float)
  
      loss = iqn.compute_eltwise_huber_quantile_loss(y, t, tau)
      y_b, t_b = torch.broadcast_tensors(
          y.reshape(batch_size, N, 1),
          t.reshape(batch_size, 1, N_prime),
      )
      assert loss.shape == (batch_size, N, N_prime)
      huber_loss = nn.functional.smooth_l1_loss(
          y_b, t_b, reduction="none"
      )
      assert huber_loss.shape == (batch_size, N, N_prime)
  
      for i in range(batch_size):
          for j in range(N):
              for k in range(N_prime):
                  # loss is always positive
                  scalar_loss = loss[i, j, k]
                  scalar_grad = torch.autograd.grad(
                      [scalar_loss], [y], retain_graph=True
                  )[0][i, j]
                  assert float(scalar_loss) > 0
                  if y[i, j] > t[i, k]:
                      # y over-estimates t
                      # loss equals huber loss scaled by (1-tau)
                      correct_scalar_loss = (
                          1 - tau[i, j]
                      ) * huber_loss[i, j, k]
                  else:
                      # y under-estimates t
                      # loss equals huber loss scaled by tau
                      correct_scalar_loss = (
                          tau[i, j] * huber_loss[i, j, k]
                      )
                  correct_scalar_grad = torch.autograd.grad(
                      [correct_scalar_loss], [y], retain_graph=True
                  )[0][i, j]
                  torch_assert_allclose(
                      scalar_loss,
                      correct_scalar_loss,
                      atol=1e-5,
                  )
                  torch_assert_allclose(
                      scalar_grad,
                      correct_scalar_grad,
                      atol=1e-5,
                  )
  
imports: import basetest_dqn_like
  import numpy
  import pytest
  import torch
  from basetest_training import _TestBatchTrainingMixin
  from torch import nn
  import pfrl
  from pfrl.agents import iqn
  from pfrl.testing import torch_assert_allclose
label_desc: Use image node_id 1 for calling a global function with example usage: test_compute_eltwise_huber_quantile_loss(batch_size, N, N_prime) without return types