Merge pull request #6619 from rohan100jain/branch_143464290
Branch 143464290
This commit is contained in:
commit
7c36309c37
@ -246,7 +246,7 @@ TEST(StrippedOpListForGraphTest, FlatTest) {
|
|||||||
FunctionDef* function_def = graph_def.mutable_library()->add_function();
|
FunctionDef* function_def = graph_def.mutable_library()->add_function();
|
||||||
function_def->mutable_signature()->set_name("F");
|
function_def->mutable_signature()->set_name("F");
|
||||||
for (const string& op : graph_ops[order]) {
|
for (const string& op : graph_ops[order]) {
|
||||||
function_def->add_node()->set_op(op);
|
function_def->add_node_def()->set_op(op);
|
||||||
}
|
}
|
||||||
graph_def.add_node()->set_op("F");
|
graph_def.add_node()->set_op("F");
|
||||||
} else {
|
} else {
|
||||||
@ -293,11 +293,11 @@ TEST(StrippedOpListForGraphTest, NestedFunctionTest) {
|
|||||||
FunctionDef* c = graph_def.mutable_library()->add_function();
|
FunctionDef* c = graph_def.mutable_library()->add_function();
|
||||||
b->mutable_signature()->set_name("B");
|
b->mutable_signature()->set_name("B");
|
||||||
c->mutable_signature()->set_name("C");
|
c->mutable_signature()->set_name("C");
|
||||||
b->add_node()->set_op("A");
|
b->add_node_def()->set_op("A");
|
||||||
c->add_node()->set_op("B");
|
c->add_node_def()->set_op("B");
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
b->add_node()->set_op("B");
|
b->add_node_def()->set_op("B");
|
||||||
c->add_node()->set_op("C");
|
c->add_node_def()->set_op("C");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use C in the graph.
|
// Use C in the graph.
|
||||||
|
@ -18,7 +18,7 @@ licenses(["notice"]) # Apache 2.0
|
|||||||
package_group(
|
package_group(
|
||||||
name = "friends",
|
name = "friends",
|
||||||
packages = [
|
packages = [
|
||||||
"//learning/deepmind/tensorflow/...",
|
"//learning/deepmind/...",
|
||||||
"//tensorflow/...",
|
"//tensorflow/...",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -177,7 +177,7 @@ class TextFileLineIterator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (next_id_ >= vocab_size_) {
|
if (next_id_ >= vocab_size_) {
|
||||||
LOG(WARNING) << "Truncated " << filename_ << " before it's end at "
|
LOG(WARNING) << "Truncated " << filename_ << " before its end at "
|
||||||
<< vocab_size_ << " records.";
|
<< vocab_size_ << " records.";
|
||||||
LOG(WARNING) << "next_id_ : " << next_id_;
|
LOG(WARNING) << "next_id_ : " << next_id_;
|
||||||
status_ = errors::OutOfRange("Finished reading ", vocab_size_,
|
status_ = errors::OutOfRange("Finished reading ", vocab_size_,
|
||||||
|
@ -709,7 +709,10 @@ def _CompressHistogram(histo_ev, bps):
|
|||||||
# See also: Histogram::Percentile() in core/lib/histogram/histogram.cc
|
# See also: Histogram::Percentile() in core/lib/histogram/histogram.cc
|
||||||
histo = histo_ev.histogram_value
|
histo = histo_ev.histogram_value
|
||||||
if not histo.num:
|
if not histo.num:
|
||||||
return [CompressedHistogramValue(b, 0.0) for b in bps]
|
return CompressedHistogramEvent(
|
||||||
|
histo_ev.wall_time,
|
||||||
|
histo_ev.step,
|
||||||
|
[CompressedHistogramValue(b, 0.0) for b in bps])
|
||||||
bucket = np.array(histo.bucket)
|
bucket = np.array(histo.bucket)
|
||||||
weights = (bucket * bps[-1] / (bucket.sum() or 1.0)).cumsum()
|
weights = (bucket * bps[-1] / (bucket.sum() or 1.0)).cumsum()
|
||||||
values = []
|
values = []
|
||||||
|
@ -351,6 +351,32 @@ class MockingEventAccumulatorTest(EventAccumulatorTest):
|
|||||||
wall_time=2, step=12, compressed_histogram_values=expected_vals2)
|
wall_time=2, step=12, compressed_histogram_values=expected_vals2)
|
||||||
self.assertEqual(acc.CompressedHistograms('hst2'), [expected_cmphst2])
|
self.assertEqual(acc.CompressedHistograms('hst2'), [expected_cmphst2])
|
||||||
|
|
||||||
|
def testCompressedHistogramsWithEmptyHistogram(self):
|
||||||
|
gen = _EventGenerator()
|
||||||
|
acc = ea.EventAccumulator(gen, compression_bps=(0, 2500, 5000, 7500, 10000))
|
||||||
|
|
||||||
|
gen.AddHistogram(
|
||||||
|
'hst1',
|
||||||
|
wall_time=1,
|
||||||
|
step=10,
|
||||||
|
hmin=None,
|
||||||
|
hmax=None,
|
||||||
|
hnum=0,
|
||||||
|
hsum=0,
|
||||||
|
hsum_squares=0,
|
||||||
|
hbucket_limit=[1, 2, 3],
|
||||||
|
hbucket=[0, 0, 0])
|
||||||
|
acc.Reload()
|
||||||
|
|
||||||
|
# Create the expected values after compressing hst1
|
||||||
|
expected_vals1 = [
|
||||||
|
ea.CompressedHistogramValue(bp, val)
|
||||||
|
for bp, val in [(0, 0.0), (2500, 0), (5000, 0), (7500, 0), (10000, 0)]
|
||||||
|
]
|
||||||
|
expected_cmphst1 = ea.CompressedHistogramEvent(
|
||||||
|
wall_time=1, step=10, compressed_histogram_values=expected_vals1)
|
||||||
|
self.assertEqual(acc.CompressedHistograms('hst1'), [expected_cmphst1])
|
||||||
|
|
||||||
def testCompressHistogram_uglyHistogram(self):
|
def testCompressHistogram_uglyHistogram(self):
|
||||||
bps = (0, 668, 1587, 3085, 5000, 6915, 8413, 9332, 10000)
|
bps = (0, 668, 1587, 3085, 5000, 6915, 8413, 9332, 10000)
|
||||||
histogram_values = ea.HistogramValue(
|
histogram_values = ea.HistogramValue(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user