import tensorflow as tf

def _float_feature(value):
  return tf.train.Feature(float_list=tf.train.FloatList(value=value.flatten()))


def _bytes_feature(value):
  if isinstance(value, str):
    value = value.encode('utf-8')
  return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))


def make_tf_example(d):
  feature = {
      'bounding_box_samples': _float_feature(d['bounding_box_samples']),
      'depth_renders': _float_feature(d['depth_renders']),
