MCPcopy Create free account
hub / github.com/google-research/language / encode_map_fn

Method encode_map_fn

language/serene/preprocessing.py:380–400  ·  view source on GitHub ↗

Read example from tfds and constructed named tensor inputs.

(example)

Source from the content-addressed store, hash-verified

378 metadata)
379
380 def encode_map_fn(example):
381 """Read example from tfds and constructed named tensor inputs."""
382 tensors = tf.py_function(
383 encode,
384 inp=[
385 example['claim_text'], example['evidence_text'],
386 example['claim_label'], example['evidence_label'],
387 example['metadata'], example['wikipedia_url'],
388 example['sentence_id']
389 ],
390 Tout=(tf.int64, tf.int64, tf.int64, tf.int64, tf.string))
391 # Keras expects (x, y), where x can be a dictionary.
392 x = {
393 'claim_text': tensors[0],
394 'evidence_text': tensors[1],
395 'claim_label': tensors[2],
396 'evidence_label': tensors[3],
397 'metadata': tensors[4]
398 }
399 y = {'claim_classification': tensors[2], 'evidence_matching': tensors[3]}
400 return x, y
401
402 return encode_map_fn
403

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected