forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathctc_ops.cs
More file actions
62 lines (58 loc) · 3.26 KB
/
ctc_ops.cs
File metadata and controls
62 lines (58 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*****************************************************************************
Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************************/
namespace Tensorflow
{
public class ctc_ops
{
/// <summary>
/// Performs greedy decoding on the logits given in inputs.
/// </summary>
/// <param name="inputs">
/// 3-D, shape: <c>(max_time x batch_size x num_classes)</c>, the logits.
/// </param>
/// <param name="sequence_length">
/// A vector containing sequence lengths, size <c>(batch_size)</c>.
/// </param>
/// <param name="name">
/// If specified, the created operation in the graph will be this one, otherwise it will be named 'CTCGreedyDecoder'.
/// </param>
/// <param name="merge_repeated">
/// If True, merge repeated classes in output.
/// </param>
/// <returns>
/// Returns a tuple with multiple values, as follows:
/// decoded_indices : Indices matrix, size <c>(total_decoded_outputs x 2)</c>,
/// of a <c>SparseTensor&lt;int64, 2&gt;</c>. The rows store: [batch, time].
/// decoded_values : Values vector, size: <c>(total_decoded_outputs)</c>,
/// of a <c>SparseTensor&lt;int64, 2&gt;</c>. The vector stores the decoded classes.
/// decoded_shape : Shape vector, size <c>(2)</c>, of the decoded SparseTensor.
/// Values are: <c>[batch_size, max_decoded_length]</c>.
/// log_probability : Matrix, size <c>(batch_size x 1)</c>, containing sequence
/// log-probabilities.
/// The Operation can be fetched from any of the Tensorreturned in the tuple values, by fetching the Operation property.
/// </returns>
/// <remarks>
/// A note about the attribute merge_repeated: if enabled, when
/// consecutive logits' maximum indices are the same, only the first of
/// these is emitted. Labeling the blank '*', the sequence "A B B * B B"
/// becomes "A B B" if merge_repeated = True and "A B B B B" if
/// merge_repeated = False.
///
/// Regardless of the value of merge_repeated, if the maximum index of a given
/// time and batch corresponds to the blank, index <c>(num_classes - 1)</c>, no new
/// element is emitted.
/// </remarks>
public Tensor[] ctc_greedy_decoder(Tensor inputs, Tensor sequence_length, bool merge_repeated = true, string name = null)
=> gen_ctc_ops.ctc_greedy_decoder(inputs, sequence_length, merge_repeated: merge_repeated, name: name);
}
}