MCPcopy Create free account
hub / github.com/tensorflow/models / mock_data

Function mock_data

official/modeling/multitask/test_utils.py:70–82  ·  view source on GitHub ↗

Mock dataset function.

(feature_name)

Source from the content-addressed store, hash-verified

68
69
70def mock_data(feature_name):
71 """Mock dataset function."""
72
73 def _generate_data(_):
74 x = tf.zeros(shape=(2,), dtype=tf.float32)
75 label = tf.zeros([1], dtype=tf.int32)
76 return {feature_name: x}, label
77
78 dataset = tf.data.Dataset.range(1)
79 dataset = dataset.repeat()
80 dataset = dataset.map(
81 _generate_data, num_parallel_calls=tf.data.experimental.AUTOTUNE)
82 return dataset.prefetch(buffer_size=1).batch(2, drop_remainder=True)
83
84
85class FooConfig(cfg.TaskConfig):

Callers 2

build_inputsMethod · 0.85
build_inputsMethod · 0.85

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected