Questions tagged [c-api]
154 questions
1
vote
0 answers
Casting a Numpy Structured Array to a C-array of structs
I'm trying to pass and access a Numpy Structured Array created in Python from the C part of an application. The usage I want to make of such array is to create the array from the Python side, use it as I will (still from Python) and then for…

Pyramid
- 31
- 8
1
vote
0 answers
Implementing python script debugging like an IDE
My application makes use of user creatable python scripts to interact with the application. I am using the python c API for this and therefore use the dlls. I neither use nor intend to deploy the python.exe itself to end users. To make things more…

user2366975
- 4,350
- 9
- 47
- 87
1
vote
1 answer
Does Tensorflow automaticaly use multiple CPUs?
I have programmed some code doing an inference with Tensorflow's C API (CPU only). It is running on a cluster node, where I have access to 24 CPUs and 1 GPU. I do not make use of the GPU as I will need to do the task CPU-only later on.
Somehow every…

tre95
- 433
- 5
- 16
1
vote
0 answers
Valgrind shows leak for TF_Session
Valgrind shows Leak_DefinitelyLost inside libtensorflow.so.
This is Valgrind message for simple session init:
- operator new(unsigned long) tensorflow::(anonymous
namespace)::PosixEnv::StartThread(tensorflow::ThreadOptions const&,
…

user10333
- 331
- 1
- 9
1
vote
1 answer
Reshaping Tensor in C
How can I reshape TF_Tensor* using Tensorflow's C_api as it's being done in C++?
TensorShape inputShape({1,1,80,80});
Tensor inputTensor;
Tensor newTensor;
bool result = inputTensor->CopyFrom(newTensor, inputShape);
I don't see a similar method…

srishti
- 117
- 1
- 14
1
vote
0 answers
Python 3 c extension module free invalid pointer
I wrote this C extension module which calculates Fibonacci numbers using fast matrix multiplication.
#include
struct Matrix {
PyObject *m[2][2];
};
static struct Matrix matrix_mult(struct Matrix mat1, const struct Matrix mat2)
{
…

ne3886
- 111
- 1
1
vote
0 answers
Lua C-API: get line when error occurs during lua-function call
When I call lua_pcall from C++ to call a Lua-function, I usually do something like this:
const int pcall {lua_pcall(lua_state, 1, 1, 0)};
if (pcall == LUA_OK){
...
return true;
// OK!
}
std::cerr << "Error: pcall failed. Code:…

user1511417
- 1,880
- 3
- 20
- 41
1
vote
1 answer
Interpret Python v2.5 code using Python v3.x and C API (with respect to integer division)
I have a v2.5 Python code which I cannot control, as it is being exported from a third party software which supports Python v2.5.
I have Python v3.3 on my machine and I want, somehow, to emulate the v2.5
using the C API. My main concern is the…

tsahmatsis
- 51
- 5
1
vote
1 answer
How to import trained DNNClassifier using C_API
I have trained DNNClassifier using Python (conda tensorflow installation). The trained model needs to be used for evaluation using C_API. Is there a way to load both graph and weights of the trained model using C_API?

M.cat
- 11
- 1
1
vote
0 answers
Optimizing core python class via C
This is more of a conceptual question than a specific code question. We're looking at optimizing some of our lower level "core" classes in our python code. There's currently a class that essentially stores a dictionary of features, and a sorted list…

Lzkatz
- 173
- 8
1
vote
0 answers
DLL calling Python C/API has dependency issues
This question is a partial resolution to the question I posted today at CTypes error loading DLL that calls another DLL. I posted this as a separate post because the problem is in dependencies with the Python C/API, not in the source code that I…

RTC222
- 2,025
- 1
- 20
- 53
1
vote
0 answers
PQgetvalue() strips spaces from result of string_agg()
I have a GNU C++ project that uses the PostgreSQL API and for some reason, it strips spaces from the result of a certain query. Other environments (psql and pgAdmin) don't. The query is:
SELECT string_agg(my_varchar, ', ') FROM my table;
Notice the…

Opux
- 702
- 1
- 10
- 30
1
vote
1 answer
Pass Python list of ints to C function using Python C API
I am having an issue processing a list of ints passed to a Python C API wrapper function using Python3.6 anaconda distro on a MacOS High Sierra. I would like to convert the list of ints passed in to an array of ints that I can work with in C. …

SciGuyMcQ
- 993
- 6
- 21
1
vote
1 answer
Tensorflow missing c_api from static library
I compiled static tensorflow library as in https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile. I'm able to load and use my graph using C++ api. But when I try to switch to c_api, I get bunch of undefined reference to…

Viacheslav Klimkov
- 31
- 4
1
vote
2 answers
What is the difference between how Excel exposes the COM API compared to the C-API
I'm using the ExcelDNA library, which seems to use a combination of Excel's C-API and COM interface.
How are these interfaces different in terms of implementation by Excel? From the Microsoft site…

Zach Smith
- 8,458
- 13
- 59
- 133