class_docstr: "Class to read a dataset of embeddings of obfuscated images.
  
  This class is used to read a tfrecord which contains the embeddings of the
  images directly. The dataset needs to contain two fields:
  - 'embed': The embeddings of the images. This field should contain a float
      vector of dimension (num_views * embed_dim), so it can then be reshaped to
      a 2D tensor.
  - 'label': The int label of the corresponding sample.
  
  Attributes:
    embed_dim: The dimension of the embeddings.
    num_views: Number of different views of each image to be found in the
      dataset (equal to the number of obfuscations + 1 for the clean image).
class_docstr_tok: ["``","Class","to","read","a","dataset","of","embeddings","of","obfuscated","images",".","This","class","is","used","to","read","a","tfrecord","which","contains","the","embeddings","of","the","images","directly",".","The","dataset","needs","to","contain","two","fields",":","-","'embed","'",":","The","embeddings","of","the","images",".","This","field","should","contain","a","float","vector","of","dimension","(","num_views","*","embed_dim",")",",","so","it","can","then","be","reshaped","to","a","2D","tensor",".","-","'label","'",":","The","int","label","of","the","corresponding","sample",".","Attributes",":","embed_dim",":","The","dimension","of","the","embeddings",".","num_views",":","Number","of","different","views","of","each","image","to","be","found","in","the","dataset","(","equal","to","the","number","of","obfuscations","+","1","for","the","clean","image",")","."]
docstr: Method to parse a batch of tf.train.Example protos for this dataset.
  
  Args:
    tf_examples: The batch of tf.train.Example protos containing the
    information for the dataset.
  
  Returns:
    A tuple of (features, labels). The tensor 'features' has shape
      (batch_size, num_views, embed_dim).
docstr_tok: ["Method","to","parse","a","batch","of","tf.train.Example","protos","for","this","dataset",".","Args",":","tf_examples",":","The","batch","of","tf.train.Example","protos","containing","the","information","for","the","dataset",".","Returns",":","A","tuple","of","(","features",",","labels",")",".","The","tensor","'features","'","has","shape","(","batch_size",",","num_views",",","embed_dim",")","."]
code: def _parse_fn(
      self, tf_examples: tf.Tensor
  ) -> Tuple[tf.Tensor, tf.Tensor]:
      """Method to parse a batch of tf.train.Example protos for this dataset.
  
      Args:
        tf_examples: The batch of tf.train.Example protos containing the
        information for the dataset.
  
      Returns:
        A tuple of (features, labels). The tensor 'features' has shape
          (batch_size, num_views, embed_dim).
      """
      keys_to_features = {
          "embed": tf.io.FixedLenFeature(
              (self.num_views * self.embed_dim), tf.float32
          ),
          "label": tf.io.FixedLenFeature((), tf.int64),
      }
      parsed = tf.io.parse_example(tf_examples, keys_to_features)
      label = parsed["label"]
      features = tf.reshape(
          parsed["embed"], [-1, self.num_views, self.embed_dim]
      )
      return features, label
  
imports: import abc
  from typing import Optional, Sequence, Tuple
  from meo.mlp_baseline import data_utils
  import tensorflow
  import tensorflow_datasets
label_desc: Use image node_id 2 for calling the ObfuscatedEmbeddingDataset obj's underlying member method code with example usage: obj._parse_fn(tf_examples) and returns: features,  label