提交 7c36309c 编写于 作者: R Rohan Jain 提交者: GitHub

Merge pull request #6619 from rohan100jain/branch_143464290

Branch 143464290
......@@ -246,7 +246,7 @@ TEST(StrippedOpListForGraphTest, FlatTest) {
FunctionDef* function_def = graph_def.mutable_library()->add_function();
function_def->mutable_signature()->set_name("F");
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");
} else {
......@@ -293,11 +293,11 @@ TEST(StrippedOpListForGraphTest, NestedFunctionTest) {
FunctionDef* c = graph_def.mutable_library()->add_function();
b->mutable_signature()->set_name("B");
c->mutable_signature()->set_name("C");
b->add_node()->set_op("A");
c->add_node()->set_op("B");
b->add_node_def()->set_op("A");
c->add_node_def()->set_op("B");
if (recursive) {
b->add_node()->set_op("B");
c->add_node()->set_op("C");
b->add_node_def()->set_op("B");
c->add_node_def()->set_op("C");
}
// Use C in the graph.
......
......@@ -18,7 +18,7 @@ licenses(["notice"]) # Apache 2.0
package_group(
name = "friends",
packages = [
"//learning/deepmind/tensorflow/...",
"//learning/deepmind/...",
"//tensorflow/...",
],
)
......
......@@ -177,7 +177,7 @@ class TextFileLineIterator
return;
}
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.";
LOG(WARNING) << "next_id_ : " << next_id_;
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
histo = histo_ev.histogram_value
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)
weights = (bucket * bps[-1] / (bucket.sum() or 1.0)).cumsum()
values = []
......
......@@ -351,6 +351,32 @@ class MockingEventAccumulatorTest(EventAccumulatorTest):
wall_time=2, step=12, compressed_histogram_values=expected_vals2)
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):
bps = (0, 668, 1587, 3085, 5000, 6915, 8413, 9332, 10000)
histogram_values = ea.HistogramValue(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册