@@ -65,9 +65,9 @@ struct ctcOptions {
65
65
int blank_label ;
66
66
};
67
67
68
- /** Compute the connectionist temporal classification loss between a sequence
69
- * of probabilities and a ground truth labeling. Optionally compute the
70
- * gradient with respect to the inputs.
68
+ /** Compute the connectionist temporal classification loss between
69
+ * a probability sequence with dtype float and a ground truth labeling.
70
+ * Optionally compute the gradient with respect to the inputs.
71
71
* \param [in] activations pointer to the activations in either CPU or GPU
72
72
* addressable memory, depending on info. We assume a fixed
73
73
* memory layout for this 3 dimensional tensor, which has dimension
@@ -112,10 +112,57 @@ API_REFERENCE ctcStatus_t compute_ctc_loss(const float* const activations,
112
112
void * workspace ,
113
113
ctcOptions options );
114
114
115
+ /** Compute the connectionist temporal classification loss between
116
+ * a probability sequence of dtype double and a ground truth labeling.
117
+ * Optionally compute the gradient with respect to the inputs.
118
+ * \param [in] activations pointer to the activations in either CPU or GPU
119
+ * addressable memory, depending on info. We assume a fixed
120
+ * memory layout for this 3 dimensional tensor, which has dimension
121
+ * (t, n, p), where t is the time index, n is the minibatch index,
122
+ * and p indexes over probabilities of each symbol in the alphabet.
123
+ * The memory layout is (t, n, p) in C order (slowest to fastest changing
124
+ * index, aka row-major), or (p, n, t) in Fortran order (fastest to slowest
125
+ * changing index, aka column-major). We also assume strides are equal to
126
+ * dimensions - there is no padding between dimensions.
127
+ * More precisely, element (t, n, p), for a problem with mini_batch examples
128
+ * in the mini batch, and alphabet_size symbols in the alphabet, is located at:
129
+ * activations[(t * mini_batch + n) * alphabet_size + p]
130
+ * \param [out] gradients if not NULL, then gradients are computed. Should be
131
+ * allocated in the same memory space as probs and memory
132
+ * ordering is identical.
133
+ * \param [in] flat_labels Always in CPU memory. A concatenation
134
+ * of all the labels for the minibatch.
135
+ * \param [in] label_lengths Always in CPU memory. The length of each label
136
+ * for each example in the minibatch.
137
+ * \param [in] input_lengths Always in CPU memory. The number of time steps
138
+ * for each sequence in the minibatch.
139
+ * \param [in] alphabet_size The number of possible output symbols. There
140
+ * should be this many probabilities for each time step.
141
+ * \param [in] mini_batch How many examples in a minibatch.
142
+ * \param [out] costs Always in CPU memory. The cost of each example in the
143
+ * minibatch.
144
+ * \param [in,out] workspace In same memory space as probs. Should be of
145
+ * size requested by get_workspace_size.
146
+ * \param [in] options see struct ctcOptions
147
+ *
148
+ * \return Status information
149
+ *
150
+ * */
151
+ API_REFERENCE ctcStatus_t compute_ctc_loss_double (const double * const activations ,
152
+ double * gradients ,
153
+ const int * const flat_labels ,
154
+ const int * const label_lengths ,
155
+ const int * const input_lengths ,
156
+ int alphabet_size ,
157
+ int minibatch ,
158
+ double * costs ,
159
+ void * workspace ,
160
+ ctcOptions options );
161
+
115
162
116
163
/** For a given set of labels and minibatch size return the required workspace
117
- * size. This will need to be allocated in the same memory space as your
118
- * probabilities.
164
+ * size when the dtype of your probabilities is float . This will need to be allocated
165
+ * in the same memory space as your probabilities.
119
166
* \param [in] label_lengths Always in CPU memory. The length of each label
120
167
* for each example in the minibatch.
121
168
* \param [in] input_lengths Always in CPU memory. The number of time steps
@@ -136,6 +183,29 @@ API_REFERENCE ctcStatus_t get_workspace_size(const int* const label_lengths,
136
183
ctcOptions info ,
137
184
size_t * size_bytes );
138
185
186
+ /** For a given set of labels and minibatch size return the required workspace
187
+ * size when the dtype of your probabilities is double. This will need to be allocated
188
+ * in the same memory space as your probabilities.
189
+ * \param [in] label_lengths Always in CPU memory. The length of each label
190
+ * for each example in the minibatch.
191
+ * \param [in] input_lengths Always in CPU memory. The number of time steps
192
+ * for each sequence in the minibatch.
193
+ * \param [in] alphabet_size How many symbols in the alphabet or, equivalently,
194
+ * the number of probabilities at each time step
195
+ * \param [in] mini_batch How many examples in a minibatch.
196
+ * \param [in] info see struct ctcOptions
197
+ * \param [out] size_bytes is pointer to a scalar where the memory
198
+ * requirement in bytes will be placed. This memory should be allocated
199
+ * at the same place, CPU or GPU, that the probs are in
200
+ *
201
+ * \return Status information
202
+ **/
203
+ API_REFERENCE ctcStatus_t get_workspace_size_double (const int * const label_lengths ,
204
+ const int * const input_lengths ,
205
+ int alphabet_size , int minibatch ,
206
+ ctcOptions info ,
207
+ size_t * size_bytes );
208
+
139
209
#ifdef __cplusplus
140
210
}
141
211
#endif
0 commit comments