I would like to pass a pointer to an array of pointers to a FFI call and I
have problems ...

​I have this method:

runOutputs: aTF_OutputArray size: anInteger
    | status outvalues |
    status := TF_Status create.
    outvalues := FFIExternalArray externalNewType: 'TF_Tensor*' size:
anInteger.
    self library
        runSession: self
        options: FFIExternalObject null
        inputs: FFIExternalObject null
        values: FFIExternalObject null
        count: 0
        outputs: aTF_OutputArray getHandle
        values: outvalues getHandle
        count: anInteger
        targets: FFIExternalObject null
        count: 0
        metadata: FFIExternalObject null
        status: status.
    status check.
    ^ outvalues

​the FFI call is like that :

runSession: aTF_Session
    options: opsTF_Buffer
    inputs: inTF_OutputArray values: inTF_TensorArray count: inCount
    outputs: outTF_OutputArray values: outTF_TensorArrayPtr count: outCount
    targets: aTF_OperationArray count: targetCount
    metadata: metaTF_Buffer
    status: aTF_Status

    "F_CAPI_EXPORT extern void TF_SessionRun(
    TF_Session* session,
    // RunOptions
    const TF_Buffer* run_options,
    // Input tensors
    const TF_Output* inputs, TF_Tensor* const* input_values, int ninputs,
    // Output tensors
    const TF_Output* outputs, TF_Tensor** output_values, int noutputs,
    // Target operations
    const TF_Operation* const* target_opers, int ntargets,
    // RunMetadata
    TF_Buffer* run_metadata,
    // Output status
     TF_Status*);"

        ^ self
        ffiCall: #(void TF_SessionRun #(TF_Session * aTF_Session, TF_Buffer
* opsTF_Buffer, TF_Output * inTF_OutputArray, TF_Tensor * inTF_TensorArray,
int inCount, TF_Output * outTF_OutputArray, TF_Tensor *
outTF_TensorArrayPtr, int outCount, TF_Operation * aTF_OperationArray, int
targetCount, TF_Buffer * metaTF_Buffer, TF_Status * aTF_Status))
        module: TensorFlowCAPI

TF_Tensor is an opaque object.

I have an error: "Could not coerce arguments".
I guess this is related to the way I pass arguments to the FFI function ?

-- 
Serge Stinckwich
UMI UMMISCO 209 (SU/IRD/UY1)
"Programs must be written for people to read, and only incidentally for
machines to execute."http://www.doesnotunderstand.org/

Reply via email to