Error in C2W2 Assignment

Following error shows up when i am trying to print the TFRecord using get_records(box - 7) function. Can anyone help ?

TypeError Traceback (most recent call last)
1 # Get 3 records from the dataset
----> 2 sample_records = get_records(dataset, 3)
4 # Print the output
5 pp.pprint(sample_records)

in get_records(dataset, num_records)
21 # Read the example data (output is a protocol buffer message)
—> 22 example.ParseFromString(serialized_example)
24 # convert the protocol bufffer message to a Python dictionary

TypeError: a bytes-like object is required, not ‘method’

Hi @samara3343 ,

Sorry for the late response.
I believe the error lies in the first 2 lines within the for loop of the get_records function:
#Get the numpy property of the tensor
serialized_example =
#Initialize a tf.train.Example() to read the serialized data
example =

For some inspiration on how to parse the serialized tensors, you can look at the following section in the TF documentation:

If you can’t make it work, you can also show the lines you wrote and I ll have a look.

Good luck and best regards