I am trying to add a function to the python API that would allow me to pass a reference to a buffer and an integer.
I have defined the function in native_client/deepspeech.h
as follows
/**
* @brief Return Logits
*
* @param aSctx A streaming state pointer returned by {@link DS_CreateStream()}.
* @param buf Buffer where logits will be stored
* @param numLostFrames Number of frames lost
* @param numElements The number of logits to return
*
* @return Number of logit frames that were lost.
*/
DEEPSPEECH_EXPORT
int DS_FetchLogits(const StreamingState* aSctx,
vector< vector<float> >* buf,
int* numLostFrames,
int numElements);
The corresponding function definition in native_client/python/__init__.py
is
class Stream(object):
...
...
def fetchLogits(self, cpm_buffer, num_lost_frames, num_elements):
if not self._impl:
raise RuntimeError("Stream object is not valid. Trying to decode an already finished stream?")
return deepspeech.impl.FetchLogits(self._impl, cpm_buffer, num_lost_frames, num_elements)
I put the function definition in native_client/python/impl.i
by adding the line
%newobject DS_FetchLogits;
What else do I have to add in order to make the function available as a part of the python API?