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

Function ResolveParam

tensorflow/contrib/tensor_forest/kernels/v4/params.cc:24–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace tensorforest {
23
24float ResolveParam(const DepthDependentParam& param, int32 depth) {
25 float val;
26 switch (param.ParamType_case()) {
27 case DepthDependentParam::kConstantValue:
28 return param.constant_value();
29
30 case DepthDependentParam::kLinear:
31 val = depth * param.linear().slope() + param.linear().y_intercept();
32 return std::min(std::max(val, param.linear().min_val()),
33 param.linear().max_val());
34
35 case DepthDependentParam::kExponential:
36 return param.exponential().bias() +
37 param.exponential().multiplier() *
38 static_cast<float>(
39 std::pow(param.exponential().base(),
40 param.exponential().depth_multiplier() * depth));
41
42 case DepthDependentParam::kThreshold:
43 if (depth >= param.threshold().threshold()) {
44 return param.threshold().on_value();
45 } else {
46 return param.threshold().off_value();
47 }
48
49 default:
50 LOG(FATAL) << "unknown parameter type";
51 }
52}
53
54} // namespace tensorforest
55} // namespace tensorflow

Callers 3

GrowStatsMethod · 0.85
ClassificationStatsMethod · 0.85
TESTFunction · 0.85

Calls 7

linearMethod · 0.80
minFunction · 0.50
maxFunction · 0.50
powClass · 0.50
biasMethod · 0.45
multiplierMethod · 0.45
baseMethod · 0.45

Tested by 1

TESTFunction · 0.68