class_docstr: Implementation of the Geometric Decision-based Attack (GeoDA), a black-box attack requiring class predictions.
  Based on reference implementation: https://github.com/thisisalirah/GeoDA
  
  | Paper link: https://arxiv.org/abs/2003.06468
class_docstr_tok: ["Implementation","of","the","Geometric","Decision-based","Attack","(","GeoDA",")",",","a","black-box","attack","requiring","class","predictions",".","Based","on","reference","implementation",":","https",":","\/\/github.com\/thisisalirah\/GeoDA","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/2003.06468"]
code: def _generate_2d_dct_basis(sub_dim: int, res: int) -> np.ndarray:
      def alpha(var_a: int, num: int):
          """
          Get alpha.
          """
          if var_a == 0:
              return math.sqrt(1.0 / num)
  
          return math.sqrt(2.0 / num)
  
      def dct(
          i_x: int, i_y: int, i_v: int, i_u: int, num: int
      ) -> float:
          """
          Get 2D DCT.
          """
          return (
              alpha(i_u, num)
              * alpha(i_v, num)
              * math.cos(((2 * i_x + 1) * (i_u * math.pi)) / (2 * num))
              * math.cos(((2 * i_y + 1) * (i_v * math.pi)) / (2 * num))
          )
  
      # We can get different frequencies by setting u and v
      u_max = sub_dim
      v_max = sub_dim
  
      dct_basis = []
      for i_u in range(u_max):
          for i_v in range(v_max):
              basis = np.zeros((res, res))
              for i_y in range(res):
                  for i_x in range(res):
                      basis[i_y, i_x] = dct(
                          i_x, i_y, i_v, i_u, max(res, v_max)
                      )
              dct_basis.append(basis)
      dct_basis_array = np.mat(
          np.reshape(dct_basis, (v_max * u_max, res * res))
      ).transpose()
  
      return dct_basis_array
  
imports: import os
  import math
  import logging
  from typing import List, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from tqdm.auto import trange
  from art.attacks.attack import EvasionAttack
  from art.config import ART_NUMPY_DTYPE
  from art.estimators.estimator import BaseEstimator
  from art.estimators.classification.classifier import ClassifierMixin
  from art.utils import check_and_transform_label_format, get_labels_np_array
label_desc: Use image node_id 2 for calling the GeoDA obj's underlying member method code with example usage: obj._generate_2d_dct_basis(sub_dim, res) and returns: dct_basis_array, math, unknown, math