Finds values and indices of the `k` largest elements for the last dimension. DEPRECATED at GraphDef version 7: Use TopKV2 instead If the input is a vector (rank-1), finds the `k` largest entries in the vector and outputs their values and indices as vectors. Thus `values[j]` is the `j`-th largest
(scope *Scope, input tf.Output, k int64, optional ...TopKAttr)
| 18389 | // |
| 18390 | // Returns The `k` largest elements along each last dimensional slice.The indices of `values` within the last dimension of `input`. |
| 18391 | func TopK(scope *Scope, input tf.Output, k int64, optional ...TopKAttr) (values tf.Output, indices tf.Output) { |
| 18392 | if scope.Err() != nil { |
| 18393 | return |
| 18394 | } |
| 18395 | attrs := map[string]interface{}{"k": k} |
| 18396 | for _, a := range optional { |
| 18397 | a(attrs) |
| 18398 | } |
| 18399 | opspec := tf.OpSpec{ |
| 18400 | Type: "TopK", |
| 18401 | Input: []tf.Input{ |
| 18402 | input, |
| 18403 | }, |
| 18404 | Attrs: attrs, |
| 18405 | } |
| 18406 | op := scope.AddOperation(opspec) |
| 18407 | return op.Output(0), op.Output(1) |
| 18408 | } |
| 18409 | |
| 18410 | // Generate the bucket boundaries for each feature based on accumulated summaries. |
| 18411 | // |
no test coverage detected