MCPcopy
hub / github.com/PaddlePaddle/PaddleRec / _bytes_feature

Function _bytes_feature

tools/dataset/utils/tfrecord_writer.py:18–24  ·  view source on GitHub ↗

Returns a bytes_list from a string / byte.

(value)

Source from the content-addressed store, hash-verified

16
17
18def _bytes_feature(value):
19 """Returns a bytes_list from a string / byte."""
20 if isinstance(value, type(tf.constant(0))):
21 value = value.numpy(
22 ) # BytesList won't unpack a string from an EagerTensor.
23 value = value if isinstance(value, list) else [value]
24 return tf.train.Feature(bytes_list=tf.train.BytesList(value=value))
25
26
27def _float_feature(value):

Callers 1

serialize_exampleFunction · 0.70

Calls 1

numpyMethod · 0.80

Tested by

no test coverage detected