Skip to content

Commit

Permalink
add tfrecord_features
Browse files Browse the repository at this point in the history
  • Loading branch information
pstjohn committed Sep 16, 2021
1 parent 061c0ad commit eef032d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nfp/preprocessing/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ def padding_values(self) -> {str: tf.constant}:
return {key: tf.constant(0, dtype=self.output_dtype)
for key in self.output_signature.keys()}

@property
def tfrecord_features(self) -> {str: tf.io.FixedLenFeature}:
"""For loading preprocessed inputs from a tf records file"""
return {key: tf.io.FixedLenFeature([], dtype=self.output_dtype if len(val.shape) == 0 else tf.string)
for key, val in self.output_signature.items()}


def load_from_json(obj, data):
for key, val in obj.__dict__.items():
Expand Down

0 comments on commit eef032d

Please sign in to comment.