class_docstr: Implementation of the following white-box attacks related to PE malware crafting:
      1) Append based attacks (example paper link: https://arxiv.org/abs/1810.08280)
      2) Section insertion attacks (example paper link: https://arxiv.org/abs/2008.07125)
      3) Slack manipulation attacks (example paper link: https://arxiv.org/abs/1810.08280)
      4) DOS Header Attacks (example paper link: https://arxiv.org/abs/1901.03583)
class_docstr_tok: ["Implementation","of","the","following","white-box","attacks","related","to","PE","malware","crafting",":","1",")","Append","based","attacks","(","example","paper","link",":","https",":","\/\/arxiv.org\/abs\/1810.08280",")","2",")","Section","insertion","attacks","(","example","paper","link",":","https",":","\/\/arxiv.org\/abs\/2008.07125",")","3",")","Slack","manipulation","attacks","(","example","paper","link",":","https",":","\/\/arxiv.org\/abs\/1810.08280",")","4",")","DOS","Header","Attacks","(","example","paper","link",":","https",":","\/\/arxiv.org\/abs\/1901.03583",")"]
docstr: Filters the input data for samples that can be made adversarial.
  
  :param x: Array with input data.
  :param y: Labels to make sure the benign files are zero masked.
  :param sample_sizes: The size of the original file, before it was padded to the input size required by MalConv
  :param automatically_append: Whether to automatically append extra spare perturbation at the end of the file.
  :param perturb_sizes: List of length batch size, each element is in itself a list containing
                        the size of the allowable perturbation region
  :param perturb_starts: List of length batch size, each element is in itself a list containing
                         the start of perturbation region.
docstr_tok: ["Filters","the","input","data","for","samples","that","can","be","made","adversarial",".",":","param","x",":","Array","with","input","data",".",":","param","y",":","Labels","to","make","sure","the","benign","files","are","zero","masked",".",":","param","sample_sizes",":","The","size","of","the","original","file",",","before","it","was","padded","to","the","input","size","required","by","MalConv",":","param","automatically_append",":","Whether","to","automatically","append","extra","spare","perturbation","at","the","end","of","the","file",".",":","param","perturb_sizes",":","List","of","length","batch","size",",","each","element","is","in","itself","a","list","containing","the","size","of","the","allowable","perturbation","region",":","param","perturb_starts",":","List","of","length","batch","size",",","each","element","is","in","itself","a","list","containing","the","start","of","perturbation","region","."]
code: def pull_out_valid_samples(
      self,
      x: np.ndarray,
      y: np.ndarray,
      sample_sizes: np.ndarray,
      automatically_append: bool = True,
      perturb_sizes: Optional[List[List[int]]] = None,
      perturb_starts: Optional[List[List[int]]] = None,
  ) -> Union[
      Tuple[np.ndarray, np.ndarray, np.ndarray],
      Tuple[
          np.ndarray,
          np.ndarray,
          np.ndarray,
          List[List[int]],
          List[List[int]],
      ],
  ]:
      """
      Filters the input data for samples that can be made adversarial.
  
      :param x: Array with input data.
      :param y: Labels to make sure the benign files are zero masked.
      :param sample_sizes: The size of the original file, before it was padded to the input size required by MalConv
      :param automatically_append: Whether to automatically append extra spare perturbation at the end of the file.
      :param perturb_sizes: List of length batch size, each element is in itself a list containing
                            the size of the allowable perturbation region
      :param perturb_starts: List of length batch size, each element is in itself a list containing
                             the start of perturbation region.
  
      """
      initial_dtype = x.dtype
  
      perturbation_size = np.zeros(len(sample_sizes), dtype=int)
      for i, sample_size in enumerate(sample_sizes):
          if self.l_0 < 1:  # l0 is a fraction of the filesize
              perturbation_size[i] = int(sample_size * self.l_0)
          else:  # or l0 is interpreted as total perturbation size
              perturbation_size[i] = int(self.l_0)
  
      if perturb_sizes is not None and perturb_starts is not None:
          (
              perturbation_size,
              perturb_sizes,
          ) = self.compute_perturbation_regions(
              perturbation_size, perturb_sizes, automatically_append
          )
  
      y = self.check_valid_size(y, sample_sizes, perturbation_size)
      if perturb_sizes is not None and perturb_starts is not None:
          return self.pull_out_adversarial_malware(
              x,
              y,
              sample_sizes,
              initial_dtype,
              perturb_sizes,
              perturb_starts,
          )
  
      return self.pull_out_adversarial_malware(
          x, y, sample_sizes, initial_dtype
      )
  
imports: import json
  import random
  import logging
  from typing import Optional, Union, Tuple, List, Dict, TYPE_CHECKING
  from tqdm.auto import trange
  import numpy
  from art.estimators.estimator import BaseEstimator, NeuralNetworkMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.attacks.attack import EvasionAttack
label_desc: Use image node_id 10 for calling the MalwareGDTensorFlow obj's underlying member method code with example usage: obj.pull_out_valid_samples(x, y, sample_sizes, automatically_append, perturb_sizes, perturb_starts) and returns: self, self