code: 
  
  
  
  
  
  
  import json
  import os
  from dataclasses import dataclass
  
  import numpy as np
  import pyarrow as pa
  
  import datasets
  from utils import get_duration
  
  
  __A  							=  10_00_00_00_00_00
  __A  							=  1_00_00
  
  __A							,    __A  							=  os.path.split(__file__)
  __A  							=  os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))
  
  
  
  
  
  
  
  def 			lowercase__  (				A_     ,			A_		)  ->							datasets.Dataset:
  
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
         __UpperCAmelCase    							=pa.Table.from_pydict({"""col""": [0] * chunk_size}		)
         __UpperCAmelCase    							=pa.concat_tables([table] * (num_examples // chunk_size)		)
         return datasets.Dataset(SCREAMING_SNAKE_CASE__     ,			fingerprint="""table_100B"""		)
  
  
  
  @dataclass
  class 							_A :
      """simple docstring"""
  
      lowerCamelCase  :       str   =   42
      lowerCamelCase  :       List[Any]   =   42
      lowerCamelCase  :       List[Any]   =   42
      lowerCamelCase  :       str   =   42
  
  
  
      def _a       (							self			:    str			)			->       List[Any]:
             __UpperCAmelCase    							=np.random.default_rng(self.seed			)
             __UpperCAmelCase    							=rng.integers(low=self.low   ,    high=self.high   ,    size=self.size			).tolist()
  
  
  
      def __iter__(							self			:    str			)			->       Union[str, Any]:
             return iter(self._sampled_values			)
  
  
  
      def __len__(							self			:    Union[str, Any]			)			->       List[Any]:
             return self.size
  
  
  
  
  
  
  
  @get_duration
  def 			lowercase__  (				A_		)  ->							List[Any]:
  
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
         __UpperCAmelCase    							=dataset[0]
  
  
  
  
  
  
  
  @get_duration
  def 			lowercase__  (				A_		)  ->							List[str]:
  
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
         __UpperCAmelCase    							=dataset[-1]
  
  
  
  
  
  
  
  @get_duration
  def 			lowercase__  (				A_		)  ->							Tuple:
  
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
         __UpperCAmelCase    							=dataset[range(len(SCREAMING_SNAKE_CASE__		) // 2     ,			len(SCREAMING_SNAKE_CASE__		) // 2 + 1024		)]
  
  
  
  
  
  
  
  @get_duration
  def 			lowercase__  (				A_		)  ->							Tuple:
  
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
         __UpperCAmelCase    							=dataset[RandIter(0     ,			len(SCREAMING_SNAKE_CASE__		)     ,			1024     ,			seed=42		)]
  
  
  
  
  
  
  
  def 			lowercase__  (				)  ->							Dict:
  
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
         __UpperCAmelCase    							={'''num examples''': SPEED_TEST_N_EXAMPLES}
         __UpperCAmelCase    							=(get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
         print("""generating dataset"""		)
         __UpperCAmelCase    							=generate_100B_dataset(num_examples=SCREAMING_SNAKE_CASE__     ,			chunk_size=SCREAMING_SNAKE_CASE__		)
         print("""Functions"""		)
         for func in functions:
                print(func.__name__		)
                __UpperCAmelCase    							=func(SCREAMING_SNAKE_CASE__		)
  
         with open(SCREAMING_SNAKE_CASE__     ,			"""wb"""		) as f:
                f.write(json.dumps(SCREAMING_SNAKE_CASE__		).encode("""utf-8"""		)		)
  
  
  if __name__ == "__main__":  # useful to run the profiler
     benchmark_table_100B()
  
  
  
  
  
style_context: 
  
  
  
  
  
  
  from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
  from numpy import divide, inta, multiply, ravel, sort, zeros_like
  
  
  
  
  
  
  
  def 			lowercase__  (				A_:	int     ,			A_:	Any=3		)  ->							Dict:
  
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
         __UpperCAmelCase    							=int(mask / 2		)
         # copy image size
         __UpperCAmelCase    							=zeros_like(A_		)
         for i in range(A_     ,			gray_img.shape[0] - bd		):
                for j in range(A_     ,			gray_img.shape[1] - bd		):
                       # get mask according with mask
                       __UpperCAmelCase    							=ravel(gray_img[i - bd : i + bd + 1, j - bd : j + bd + 1]		)
                       # calculate mask median
                       __UpperCAmelCase    							=sort(A_		)[inta(divide((multiply(A_     ,			A_		))     ,			2		) + 1		)]
                       __UpperCAmelCase    							=median
         return median_img
  
  
  if __name__ == "__main__":
     # read original image
     __A  							=  imread("../image_data/lena.jpg")
     # turn image in gray scale value
     __A  							=  cvtColor(img, COLOR_BGR2GRAY)
  
     # get values with two different mask size
     __A  							=  median_filter(gray, 3)
     __A  							=  median_filter(gray, 5)
  
     # show result images
     imshow("median filter with 3x3 mask", medianaxa)
     imshow("median filter with 5x5 mask", medianaxa)
     waitKey(0)
  
  
  
  
  