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

Method ConvertLabel

tensorflow/core/kernels/hinge-loss.h:109–121  ·  view source on GitHub ↗

Converts binary example labels from 0.0 or 1.0 to -1.0 or 1.0 respectively as expected by hinge loss.

Source from the content-addressed store, hash-verified

107 // Converts binary example labels from 0.0 or 1.0 to -1.0 or 1.0 respectively
108 // as expected by hinge loss.
109 Status ConvertLabel(float* const example_label) const final {
110 if (*example_label == 0.0) {
111 *example_label = -1;
112 return Status::OK();
113 }
114 if (*example_label == 1.0) {
115 return Status::OK();
116 }
117 return errors::InvalidArgument(
118 "Only labels of 0.0 or 1.0 are supported right now. "
119 "Found example with label: ",
120 *example_label);
121 }
122};
123
124} // namespace tensorflow

Callers 3

TESTFunction · 0.45
DoComputeFunction · 0.45

Calls 1

InvalidArgumentFunction · 0.85

Tested by 1

TESTFunction · 0.36