MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/contrib/tensor_forest/kernels/v4/grow_stats_test.cc:68–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68TEST(GrowStatsDenseClassificationTest, Basic) {
69 TensorForestParams params;
70 params.set_num_outputs(2);
71 params.mutable_split_after_samples()->set_constant_value(2);
72 params.mutable_num_splits_to_consider()->set_constant_value(2);
73 std::unique_ptr<DenseClassificationGrowStats> stat(
74 new DenseClassificationGrowStats(params, 1));
75 stat->Initialize();
76
77 std::vector<float> labels = {1, 0, 1};
78 std::vector<float> weights = {2.3, 20.3, 1.1};
79 std::unique_ptr<TestableInputTarget> target(
80 new TestableInputTarget(labels, weights, 1));
81
82 RunBatch(stat.get(), target.get());
83 CHECK(stat->IsFinished());
84
85 FertileSlot slot;
86 stat->PackToProto(&slot);
87
88 string serialized = slot.DebugString();
89
90 std::unique_ptr<DenseClassificationGrowStats> new_stat(
91 new DenseClassificationGrowStats(params, 1));
92 new_stat->ExtractFromProto(slot);
93 FertileSlot second_one;
94 new_stat->PackToProto(&second_one);
95 string serialized_again = second_one.DebugString();
96 ASSERT_EQ(serialized_again, serialized);
97}
98
99class TestableRunningStats : public DenseClassificationGrowStats {
100 public:

Callers

nothing calls this directly

Calls 15

RunBatchFunction · 0.85
MakeSplitFunction · 0.85
set_constant_valueMethod · 0.80
test_left_sumMethod · 0.80
test_left_squareMethod · 0.80
test_right_sumMethod · 0.80
test_right_squareMethod · 0.80
AddSplitMethod · 0.80
num_splitsMethod · 0.80
accumulateMethod · 0.80
set_sum_and_squareMethod · 0.80
InitializeMethod · 0.45

Tested by

no test coverage detected