This document describes the conventions behind the THNN API.
All functions provided by THNN are stored in aten/src/THNN/generic/THNN.h
.
Look at this file.
Please remember, that because C doesn't support function overloading, functions taking different tensor types have different names. So e.g. for an Abs module, there are actually two updateOutput functions:
void THNN_FloatAbs_updateOutput(...)
void THNN_DoubleAbs_updateOutput(...)
In these docs such function will be referred to as void THNN_Abs_updateOutput(...)
, and it's up to developer to add a type prefix. real
is an alias for that type.
Some arguments have additional tags placed in square brackets in their header declarations:
- [OUT] - This is the output argument. It will be reshaped if needed.
- [OPTIONAL] - This argument is optional and can be safely set to NULL
- [BUFFER] - A buffer.
updateGradInput
andaccGradParameters
should get the same buffers that were used inupdateOutput
call. - [MODIFIED] - Some functions accept an
inplace
flag. If set to true, this argument might be modified (in addition to the output).