Move CTC Op docstring from class definition to gpu_ctc function

上级 0e516484
...@@ -24,24 +24,12 @@ class GpuConnectionistTemporalClassification(gof.COp): ...@@ -24,24 +24,12 @@ class GpuConnectionistTemporalClassification(gof.COp):
Parameters Parameters
---------- ----------
activations compute_grad
Three-dimensional tensor, which has a shape of (t, m, p), where If set to True, enables the computation of gradients of the CTC loss function.
t is the time index, m is the minibatch index, and p is the index
over the probabilities of each symbol in the alphabet. The memory
layout is assumed to be in C-order, which consists in the slowest
to the fastest changing dimension, from left to right. In this case,
p is the fastest changing dimension.
labels
A 1-D tensor of all the labels for the minibatch.
input_lengths
A 1-D tensor with the number of time steps for each sequence in
the minibatch.
Returns Returns
------- -------
1-D tensor GPU Op
Cost of each example in the minibatch. Tensor is of shape An instance of the GPU CTC loss computation Op
(time index, minibatch index, probabilities).
""" """
__props__ = ('compute_grad',) __props__ = ('compute_grad',)
...@@ -151,6 +139,30 @@ class GpuConnectionistTemporalClassification(gof.COp): ...@@ -151,6 +139,30 @@ class GpuConnectionistTemporalClassification(gof.COp):
def gpu_ctc(activations, labels, input_lengths): def gpu_ctc(activations, labels, input_lengths):
"""
Compute CTC loss function on the GPU.
Parameters
----------
activations
Three-dimensional tensor, which has a shape of (t, m, p), where
t is the time index, m is the minibatch index, and p is the index
over the probabilities of each symbol in the alphabet. The memory
layout is assumed to be in C-order, which consists in the slowest
to the fastest changing dimension, from left to right. In this case,
p is the fastest changing dimension.
labels
A 1-D tensor of all the labels for the minibatch.
input_lengths
A 1-D tensor with the number of time steps for each sequence in
the minibatch.
Returns
-------
1-D tensor
Cost of each example in the minibatch. Tensor is of shape
(time index, minibatch index, probabilities).
"""
return GpuConnectionistTemporalClassification()(activations, labels, return GpuConnectionistTemporalClassification()(activations, labels,
input_lengths) input_lengths)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论