To create a TF Record:
- Open a TFRecords file using
tf.python_io.TFRecordWriter
- Convert your data into the proper data type of the feature using
tf.train.Int64List
,tf.train.BytesList
, ortf.train.FloatList
- Create a feature using
tf.train.Feature
and pass the converted data to it - Create an Example protocol buffer using
tf.train.Example
and pass the feature to it - Serialize the Example to string using
example.SerializeToString()
- Write the serialized example to TFRecords file using
writer.write
Source: http://machinelearninguru.com/deep_learning/data_preparation/tfrecord/tfrecord.html
- Importing Data. Create a Dataset instance from some data
- Create an Iterator. By using the created dataset to make an Iterator instance to iterate thought the dataset
- Consuming Data. By using the created iterator we can get the elements from the dataset to feed the model
https://towardsdatascience.com/how-to-use-dataset-in-tensorflow-c758ef9e4428
https://medium.com/@TalPerry/getting-text-into-tensorflow-with-the-dataset-api-ffb832c8bec6
List all available devices (CPU/GPU):
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())