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: Update embeddings.
  
  :param embeddings: Embeddings produced by the data from passing it through the first embedding layer of MalConv
  :param gradients: Gradients to update the embeddings
  :param mask: Tensor with 1s on the embeddings we modify, 0s elsewhere.
  :return embeddings: Updated embeddings wrt the adversarial objective.
docstr_tok: ["Update","embeddings",".",":","param","embeddings",":","Embeddings","produced","by","the","data","from","passing","it","through","the","first","embedding","layer","of","MalConv",":","param","gradients",":","Gradients","to","update","the","embeddings",":","param","mask",":","Tensor","with","1s","on","the","embeddings","we","modify",",","0s","elsewhere",".",":","return","embeddings",":","Updated","embeddings","wrt","the","adversarial","objective","."]
code: def update_embeddings(
      self,
      embeddings: "tf.Tensor",
      gradients: "tf.Tensor",
      mask: "tf.Tensor",
  ) -> "tf.Tensor":
      """
      Update embeddings.
  
      :param embeddings: Embeddings produced by the data from passing it through the first embedding layer of MalConv
      :param gradients: Gradients to update the embeddings
      :param mask: Tensor with 1s on the embeddings we modify, 0s elsewhere.
      :return embeddings: Updated embeddings wrt the adversarial objective.
      """
      import tensorflow as tf
  
      if self.use_sign:
          gradients = tf.sign(gradients)
      embeddings = embeddings + self.l_r * gradients * mask
      return embeddings
  
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 6 for calling the MalwareGDTensorFlow obj's underlying member method code with example usage: obj.update_embeddings(embeddings, gradients, mask) and returns: embeddings