1 | // This file is MACHINE GENERATED! Do not edit. |
2 | |
3 | |
4 | #include "tensorflow/cc/ops/const_op.h" |
5 | #include "tensorflow/cc/ops/candidate_sampling_ops.h" |
6 | |
7 | namespace tensorflow { |
8 | namespace ops { |
9 | |
10 | AllCandidateSampler::AllCandidateSampler(const ::tensorflow::Scope& scope, |
11 | ::tensorflow::Input true_classes, |
12 | int64 num_true, int64 num_sampled, |
13 | bool unique, const |
14 | AllCandidateSampler::Attrs& attrs) { |
15 | if (!scope.ok()) return; |
16 | auto _true_classes = ::tensorflow::ops::AsNodeOut(scope, true_classes); |
17 | if (!scope.ok()) return; |
18 | ::tensorflow::Node* ret; |
19 | const auto unique_name = scope.GetUniqueNameForOp("AllCandidateSampler" ); |
20 | auto builder = ::tensorflow::NodeBuilder(unique_name, "AllCandidateSampler" ) |
21 | .Input(_true_classes) |
22 | .Attr("num_true" , num_true) |
23 | .Attr("num_sampled" , num_sampled) |
24 | .Attr("unique" , unique) |
25 | .Attr("seed" , attrs.seed_) |
26 | .Attr("seed2" , attrs.seed2_) |
27 | ; |
28 | scope.UpdateBuilder(&builder); |
29 | scope.UpdateStatus(builder.Finalize(scope.graph(), &ret)); |
30 | if (!scope.ok()) return; |
31 | scope.UpdateStatus(scope.DoShapeInference(ret)); |
32 | this->operation = Operation(ret); |
33 | ::tensorflow::NameRangeMap _outputs_range; |
34 | ::tensorflow::Status _status_ = ::tensorflow::NameRangesForNode(*ret, ret->op_def(), nullptr, &_outputs_range); |
35 | if (!_status_.ok()) { |
36 | scope.UpdateStatus(_status_); |
37 | return; |
38 | } |
39 | |
40 | this->sampled_candidates = Output(ret, _outputs_range["sampled_candidates" ].first); |
41 | this->true_expected_count = Output(ret, _outputs_range["true_expected_count" ].first); |
42 | this->sampled_expected_count = Output(ret, _outputs_range["sampled_expected_count" ].first); |
43 | } |
44 | |
45 | AllCandidateSampler::AllCandidateSampler(const ::tensorflow::Scope& scope, |
46 | ::tensorflow::Input true_classes, |
47 | int64 num_true, int64 num_sampled, |
48 | bool unique) |
49 | : AllCandidateSampler(scope, true_classes, num_true, num_sampled, unique, AllCandidateSampler::Attrs()) {} |
50 | |
51 | ComputeAccidentalHits::ComputeAccidentalHits(const ::tensorflow::Scope& scope, |
52 | ::tensorflow::Input true_classes, |
53 | ::tensorflow::Input |
54 | sampled_candidates, int64 |
55 | num_true, const |
56 | ComputeAccidentalHits::Attrs& |
57 | attrs) { |
58 | if (!scope.ok()) return; |
59 | auto _true_classes = ::tensorflow::ops::AsNodeOut(scope, true_classes); |
60 | if (!scope.ok()) return; |
61 | auto _sampled_candidates = ::tensorflow::ops::AsNodeOut(scope, sampled_candidates); |
62 | if (!scope.ok()) return; |
63 | ::tensorflow::Node* ret; |
64 | const auto unique_name = scope.GetUniqueNameForOp("ComputeAccidentalHits" ); |
65 | auto builder = ::tensorflow::NodeBuilder(unique_name, "ComputeAccidentalHits" ) |
66 | .Input(_true_classes) |
67 | .Input(_sampled_candidates) |
68 | .Attr("num_true" , num_true) |
69 | .Attr("seed" , attrs.seed_) |
70 | .Attr("seed2" , attrs.seed2_) |
71 | ; |
72 | scope.UpdateBuilder(&builder); |
73 | scope.UpdateStatus(builder.Finalize(scope.graph(), &ret)); |
74 | if (!scope.ok()) return; |
75 | scope.UpdateStatus(scope.DoShapeInference(ret)); |
76 | this->operation = Operation(ret); |
77 | ::tensorflow::NameRangeMap _outputs_range; |
78 | ::tensorflow::Status _status_ = ::tensorflow::NameRangesForNode(*ret, ret->op_def(), nullptr, &_outputs_range); |
79 | if (!_status_.ok()) { |
80 | scope.UpdateStatus(_status_); |
81 | return; |
82 | } |
83 | |
84 | this->indices = Output(ret, _outputs_range["indices" ].first); |
85 | this->ids = Output(ret, _outputs_range["ids" ].first); |
86 | this->weights = Output(ret, _outputs_range["weights" ].first); |
87 | } |
88 | |
89 | ComputeAccidentalHits::ComputeAccidentalHits(const ::tensorflow::Scope& scope, |
90 | ::tensorflow::Input true_classes, |
91 | ::tensorflow::Input |
92 | sampled_candidates, int64 |
93 | num_true) |
94 | : ComputeAccidentalHits(scope, true_classes, sampled_candidates, num_true, ComputeAccidentalHits::Attrs()) {} |
95 | |
96 | FixedUnigramCandidateSampler::FixedUnigramCandidateSampler(const |
97 | ::tensorflow::Scope& |
98 | scope, |
99 | ::tensorflow::Input |
100 | true_classes, int64 |
101 | num_true, int64 |
102 | num_sampled, bool |
103 | unique, int64 |
104 | range_max, const |
105 | FixedUnigramCandidateSampler::Attrs& |
106 | attrs) { |
107 | if (!scope.ok()) return; |
108 | auto _true_classes = ::tensorflow::ops::AsNodeOut(scope, true_classes); |
109 | if (!scope.ok()) return; |
110 | ::tensorflow::Node* ret; |
111 | const auto unique_name = scope.GetUniqueNameForOp("FixedUnigramCandidateSampler" ); |
112 | auto builder = ::tensorflow::NodeBuilder(unique_name, "FixedUnigramCandidateSampler" ) |
113 | .Input(_true_classes) |
114 | .Attr("num_true" , num_true) |
115 | .Attr("num_sampled" , num_sampled) |
116 | .Attr("unique" , unique) |
117 | .Attr("range_max" , range_max) |
118 | .Attr("vocab_file" , attrs.vocab_file_) |
119 | .Attr("distortion" , attrs.distortion_) |
120 | .Attr("num_reserved_ids" , attrs.num_reserved_ids_) |
121 | .Attr("num_shards" , attrs.num_shards_) |
122 | .Attr("shard" , attrs.shard_) |
123 | .Attr("unigrams" , attrs.unigrams_) |
124 | .Attr("seed" , attrs.seed_) |
125 | .Attr("seed2" , attrs.seed2_) |
126 | ; |
127 | scope.UpdateBuilder(&builder); |
128 | scope.UpdateStatus(builder.Finalize(scope.graph(), &ret)); |
129 | if (!scope.ok()) return; |
130 | scope.UpdateStatus(scope.DoShapeInference(ret)); |
131 | this->operation = Operation(ret); |
132 | ::tensorflow::NameRangeMap _outputs_range; |
133 | ::tensorflow::Status _status_ = ::tensorflow::NameRangesForNode(*ret, ret->op_def(), nullptr, &_outputs_range); |
134 | if (!_status_.ok()) { |
135 | scope.UpdateStatus(_status_); |
136 | return; |
137 | } |
138 | |
139 | this->sampled_candidates = Output(ret, _outputs_range["sampled_candidates" ].first); |
140 | this->true_expected_count = Output(ret, _outputs_range["true_expected_count" ].first); |
141 | this->sampled_expected_count = Output(ret, _outputs_range["sampled_expected_count" ].first); |
142 | } |
143 | |
144 | FixedUnigramCandidateSampler::FixedUnigramCandidateSampler(const |
145 | ::tensorflow::Scope& |
146 | scope, |
147 | ::tensorflow::Input |
148 | true_classes, int64 |
149 | num_true, int64 |
150 | num_sampled, bool |
151 | unique, int64 |
152 | range_max) |
153 | : FixedUnigramCandidateSampler(scope, true_classes, num_true, num_sampled, unique, range_max, FixedUnigramCandidateSampler::Attrs()) {} |
154 | |
155 | LearnedUnigramCandidateSampler::LearnedUnigramCandidateSampler(const |
156 | ::tensorflow::Scope& |
157 | scope, |
158 | ::tensorflow::Input |
159 | true_classes, |
160 | int64 num_true, |
161 | int64 |
162 | num_sampled, |
163 | bool unique, |
164 | int64 range_max, |
165 | const |
166 | LearnedUnigramCandidateSampler::Attrs& |
167 | attrs) { |
168 | if (!scope.ok()) return; |
169 | auto _true_classes = ::tensorflow::ops::AsNodeOut(scope, true_classes); |
170 | if (!scope.ok()) return; |
171 | ::tensorflow::Node* ret; |
172 | const auto unique_name = scope.GetUniqueNameForOp("LearnedUnigramCandidateSampler" ); |
173 | auto builder = ::tensorflow::NodeBuilder(unique_name, "LearnedUnigramCandidateSampler" ) |
174 | .Input(_true_classes) |
175 | .Attr("num_true" , num_true) |
176 | .Attr("num_sampled" , num_sampled) |
177 | .Attr("unique" , unique) |
178 | .Attr("range_max" , range_max) |
179 | .Attr("seed" , attrs.seed_) |
180 | .Attr("seed2" , attrs.seed2_) |
181 | ; |
182 | scope.UpdateBuilder(&builder); |
183 | scope.UpdateStatus(builder.Finalize(scope.graph(), &ret)); |
184 | if (!scope.ok()) return; |
185 | scope.UpdateStatus(scope.DoShapeInference(ret)); |
186 | this->operation = Operation(ret); |
187 | ::tensorflow::NameRangeMap _outputs_range; |
188 | ::tensorflow::Status _status_ = ::tensorflow::NameRangesForNode(*ret, ret->op_def(), nullptr, &_outputs_range); |
189 | if (!_status_.ok()) { |
190 | scope.UpdateStatus(_status_); |
191 | return; |
192 | } |
193 | |
194 | this->sampled_candidates = Output(ret, _outputs_range["sampled_candidates" ].first); |
195 | this->true_expected_count = Output(ret, _outputs_range["true_expected_count" ].first); |
196 | this->sampled_expected_count = Output(ret, _outputs_range["sampled_expected_count" ].first); |
197 | } |
198 | |
199 | LearnedUnigramCandidateSampler::LearnedUnigramCandidateSampler(const |
200 | ::tensorflow::Scope& |
201 | scope, |
202 | ::tensorflow::Input |
203 | true_classes, |
204 | int64 num_true, |
205 | int64 |
206 | num_sampled, |
207 | bool unique, |
208 | int64 range_max) |
209 | : LearnedUnigramCandidateSampler(scope, true_classes, num_true, num_sampled, unique, range_max, LearnedUnigramCandidateSampler::Attrs()) {} |
210 | |
211 | LogUniformCandidateSampler::LogUniformCandidateSampler(const |
212 | ::tensorflow::Scope& |
213 | scope, |
214 | ::tensorflow::Input |
215 | true_classes, int64 |
216 | num_true, int64 |
217 | num_sampled, bool |
218 | unique, int64 range_max, |
219 | const |
220 | LogUniformCandidateSampler::Attrs& |
221 | attrs) { |
222 | if (!scope.ok()) return; |
223 | auto _true_classes = ::tensorflow::ops::AsNodeOut(scope, true_classes); |
224 | if (!scope.ok()) return; |
225 | ::tensorflow::Node* ret; |
226 | const auto unique_name = scope.GetUniqueNameForOp("LogUniformCandidateSampler" ); |
227 | auto builder = ::tensorflow::NodeBuilder(unique_name, "LogUniformCandidateSampler" ) |
228 | .Input(_true_classes) |
229 | .Attr("num_true" , num_true) |
230 | .Attr("num_sampled" , num_sampled) |
231 | .Attr("unique" , unique) |
232 | .Attr("range_max" , range_max) |
233 | .Attr("seed" , attrs.seed_) |
234 | .Attr("seed2" , attrs.seed2_) |
235 | ; |
236 | scope.UpdateBuilder(&builder); |
237 | scope.UpdateStatus(builder.Finalize(scope.graph(), &ret)); |
238 | if (!scope.ok()) return; |
239 | scope.UpdateStatus(scope.DoShapeInference(ret)); |
240 | this->operation = Operation(ret); |
241 | ::tensorflow::NameRangeMap _outputs_range; |
242 | ::tensorflow::Status _status_ = ::tensorflow::NameRangesForNode(*ret, ret->op_def(), nullptr, &_outputs_range); |
243 | if (!_status_.ok()) { |
244 | scope.UpdateStatus(_status_); |
245 | return; |
246 | } |
247 | |
248 | this->sampled_candidates = Output(ret, _outputs_range["sampled_candidates" ].first); |
249 | this->true_expected_count = Output(ret, _outputs_range["true_expected_count" ].first); |
250 | this->sampled_expected_count = Output(ret, _outputs_range["sampled_expected_count" ].first); |
251 | } |
252 | |
253 | LogUniformCandidateSampler::LogUniformCandidateSampler(const |
254 | ::tensorflow::Scope& |
255 | scope, |
256 | ::tensorflow::Input |
257 | true_classes, int64 |
258 | num_true, int64 |
259 | num_sampled, bool |
260 | unique, int64 range_max) |
261 | : LogUniformCandidateSampler(scope, true_classes, num_true, num_sampled, unique, range_max, LogUniformCandidateSampler::Attrs()) {} |
262 | |
263 | UniformCandidateSampler::UniformCandidateSampler(const ::tensorflow::Scope& |
264 | scope, ::tensorflow::Input |
265 | true_classes, int64 num_true, |
266 | int64 num_sampled, bool |
267 | unique, int64 range_max, const |
268 | UniformCandidateSampler::Attrs& |
269 | attrs) { |
270 | if (!scope.ok()) return; |
271 | auto _true_classes = ::tensorflow::ops::AsNodeOut(scope, true_classes); |
272 | if (!scope.ok()) return; |
273 | ::tensorflow::Node* ret; |
274 | const auto unique_name = scope.GetUniqueNameForOp("UniformCandidateSampler" ); |
275 | auto builder = ::tensorflow::NodeBuilder(unique_name, "UniformCandidateSampler" ) |
276 | .Input(_true_classes) |
277 | .Attr("num_true" , num_true) |
278 | .Attr("num_sampled" , num_sampled) |
279 | .Attr("unique" , unique) |
280 | .Attr("range_max" , range_max) |
281 | .Attr("seed" , attrs.seed_) |
282 | .Attr("seed2" , attrs.seed2_) |
283 | ; |
284 | scope.UpdateBuilder(&builder); |
285 | scope.UpdateStatus(builder.Finalize(scope.graph(), &ret)); |
286 | if (!scope.ok()) return; |
287 | scope.UpdateStatus(scope.DoShapeInference(ret)); |
288 | this->operation = Operation(ret); |
289 | ::tensorflow::NameRangeMap _outputs_range; |
290 | ::tensorflow::Status _status_ = ::tensorflow::NameRangesForNode(*ret, ret->op_def(), nullptr, &_outputs_range); |
291 | if (!_status_.ok()) { |
292 | scope.UpdateStatus(_status_); |
293 | return; |
294 | } |
295 | |
296 | this->sampled_candidates = Output(ret, _outputs_range["sampled_candidates" ].first); |
297 | this->true_expected_count = Output(ret, _outputs_range["true_expected_count" ].first); |
298 | this->sampled_expected_count = Output(ret, _outputs_range["sampled_expected_count" ].first); |
299 | } |
300 | |
301 | UniformCandidateSampler::UniformCandidateSampler(const ::tensorflow::Scope& |
302 | scope, ::tensorflow::Input |
303 | true_classes, int64 num_true, |
304 | int64 num_sampled, bool |
305 | unique, int64 range_max) |
306 | : UniformCandidateSampler(scope, true_classes, num_true, num_sampled, unique, range_max, UniformCandidateSampler::Attrs()) {} |
307 | |
308 | /// @} |
309 | |
310 | } // namespace ops |
311 | } // namespace tensorflow |
312 | |