d9815bc9a70bf7362465c5839d082bd2af4b4771,oneoffs/inspect_examples.py,,ReadExamples,#Any#,67

Before Change


        "outcome": tf.FixedLenFeature([], tf.float32),
    }

    result = []
    for record in tf.python_io.tf_record_iterator(path, TF_RECORD_CONFIG):
        example = tf.train.Example()
        example.ParseFromString(record)

        parsed = tf.parse_example([record], features)

        x = tf.decode_raw(parsed["x"], tf.uint8)
        x = tf.cast(x, tf.float32)
        x = tf.reshape(x, [go.N, go.N, -1])

        pi = tf.decode_raw(parsed["pi"], tf.float32)
        pi = tf.reshape(pi, [go.N * go.N + 1])

        outcome = parsed["outcome"]
        assert outcome.shape == (1,)

        result.append(ParsedExample(x.eval(), pi.eval(), outcome.eval()))
    return result


def parse_board(example):
    Parses a go board from a TF example.

After Change


        "outcome": tf.FixedLenFeature([], tf.float32),
    }

    records = list(tf.python_io.tf_record_iterator(path, TF_RECORD_CONFIG))
    num_records = len(records)
    parsed = tf.parse_example(records, features)

    x = tf.decode_raw(parsed["x"], tf.uint8)
    x = tf.cast(x, tf.float32)
    x = tf.reshape(x, [num_records, go.N, go.N, -1])
    x = x.eval()

    pi = tf.decode_raw(parsed["pi"], tf.float32)
    pi = tf.reshape(pi, [num_records, go.N * go.N + 1])
    pi = pi.eval()

    outcome = parsed["outcome"]
    outcome = outcome.eval()

    return [ParsedExample(*args) for args in zip(x, pi, outcome)]


def parse_board(example):
    Parses a go board from a TF example.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 13

Instances


Project Name: tensorflow/minigo
Commit Name: d9815bc9a70bf7362465c5839d082bd2af4b4771
Time: 2019-11-05
Author: tmadams@google.com
File Name: oneoffs/inspect_examples.py
Class Name:
Method Name: ReadExamples


Project Name: IndicoDataSolutions/finetune
Commit Name: 04573605a3bef45d29d81302bce154f220bbd7f5
Time: 2019-01-15
Author: matthew.bayer@indico.io
File Name: finetune/target_encoders.py
Class Name: OrdinalRegressionEncoder
Method Name: rank_to_thresholds


Project Name: tensorflow/minigo
Commit Name: d9815bc9a70bf7362465c5839d082bd2af4b4771
Time: 2019-11-05
Author: tmadams@google.com
File Name: oneoffs/inspect_examples.py
Class Name:
Method Name: ReadExamples


Project Name: graphbrain/graphbrain
Commit Name: 14e7753441932b61c5eb061dcc5c18a2f2ae4721
Time: 2016-07-29
Author: telmo@telmomenezes.net
File Name: gb/hypergraph/sql.py
Class Name:
Method Name: nthperm