示例#1
0
def _mock_example_with_image(shape):
    arr = _image_array(shape)
    feature = {
        'image/encoded': _bytes_feature([arr.tobytes()]),
        'image/shape': _int_feature(shape)
    }
    return arr, example_pb2.Example(features=feature_pb2.Features(
        feature=feature))
示例#2
0
def _mock_example_with_variant_and_alt_allele_indices(
    encoded_indices=b'\n\x01\x00', alleles=('A', 'C')):
    variant = test_utils.make_variant(chrom='X', alleles=alleles, start=10)
    feature = {
        'variant/encoded': _bytes_feature([variant.SerializeToString()]),
        'alt_allele_indices/encoded': _bytes_feature([encoded_indices])
    }
    return example_pb2.Example(features=feature_pb2.Features(feature=feature))
示例#3
0
 def test_label_from_example(self, truth_label):
   feature = {'label': _int_feature([truth_label])}
   example = example_pb2.Example(
       features=feature_pb2.Features(feature=feature))
   output = vis.label_from_example(example)
   self.assertEqual(truth_label, output)