Questions tagged [c-api]

154 questions
3
votes
1 answer

How to find out the correct input and output operation of a frozen tensorflow graph?

I received a neural network trained in python, the format is frozen graph (.pb). In order to do the inference using the C-API (which is required for this special case) I need to find out the name of the input and output operation of the graph.…
tre95
  • 433
  • 5
  • 16
3
votes
2 answers

Swift bridging 2D Array to type UnsafePointer?>?

Hi I am trying to wrap a C api using Swift 4 Swift has imported a function with the following signature. public typealias indicator = @convention(c) (Int32, UnsafePointer?>?, UnsafePointer?,…
lbdl
  • 353
  • 1
  • 4
  • 8
3
votes
2 answers

How to access the asyncio / uvloop loop from C

I'm completely new to python, but have an async python app using uvloop which uses a C api module I created which also needs access to the async loop. 1) asyncio does not yet have a c-api for this? Any hacks to get an event loop usable in C? Is…
Craftables
  • 236
  • 1
  • 8
3
votes
1 answer

python 3.x C extension module and submodule

How do I make a C extension for python 3.x when a module has sub-modules? For example, I have a file called pet.c: #include PyObject* CatMeow(PyObject* self) { return PyUnicode_FromString( ">*<" ); } static PyMethodDef…
hyunacrest
  • 73
  • 6
3
votes
1 answer

Lua C API: setting error source information

I'm implementing a simple LUA online interpreter which takes multiple LUA scripts from plain text (i.e. C strings) and runs them. Everything is working OK but now I'm testing my program's response when syntax or runtime errors occur from those…
Claudi
  • 5,224
  • 17
  • 30
3
votes
0 answers

Segmentation fault in PyArray_SimpleNewFromData

I am looking to pass an array from C++ to Python using C-API. By looking at various topics here, I came to know that I should be using PyArray_SimpleNewFromData method. When I am trying to implement on a very small array, I am getiing a segmentation…
Sajal Jain
  • 263
  • 1
  • 3
  • 11
3
votes
0 answers

Is there an API for SMART?

Developing a NAS system at the moment and I want to use SMART to monitor the state of the harddrive in the NAS. I have looked at tools like smartmontools smartctl and smartd however I want to have more control over the what I tell the NAS to react…
GurgL
  • 103
  • 1
  • 7
3
votes
1 answer

Run a function when a C extension module is freed on python 2

I have a C extension module for Python. When the module is initialized, I malloc() some memory that I only use in the C code. I would like to free this memory when the module is freed. Python 3 has m_free member on PyModuleDef struct that is exactly…
2
votes
2 answers

Storing images using Blob data type in aerospike

I am trying to write image ( .png/.jpeg/...etc) files to aerospike. From aerospike documentation (https://docs.aerospike.com/server/guide/data-types/blob) I understand that this can be achieved using blob data type. However there is no documentation…
Gopi
  • 689
  • 1
  • 8
  • 17
2
votes
0 answers

Passing 2D c++ vector to a python function and getting output back as 2D array

I have been stuck on this for a week now.I am intializing a 2D vector of doubles and passing it to a simple python function which multiplies it by 2 and returns it. def in_arr_out_arr(arr_input): print(arr_input) arr_input2 = 2*arr_input …
pppp_prs
  • 106
  • 1
  • 8
2
votes
1 answer

Lib using Tcl C API is crashing maybe due bad refCount usage

I'm a beginner at Tcl C API and I'm trying to understand how to use it. I have this code that gets a tcl list from get_my_list proc and then I iterate over it to dispatch some info, in this case, info related to attributes A, B and C that I get with…
João Paulo
  • 6,300
  • 4
  • 51
  • 80
2
votes
0 answers

Working python-C numpy-C API segfaults with additional elements

Happy Holidays... Working Python-C numpy C-API with if (!PyArg_ParseTuple(args, "lOO!O!O!O!O!O!O!", &N, &mychunk, &PyArray_Type, &py_local_F, &PyArray_Type, &py_centers, &PyArray_Type, &py_normals, &PyArray_Type, &py_v1, &PyArray_Type, &py_v2,…
2
votes
0 answers

output layers' name in C api Tensorflow

I am trying to load a pre-trained Tensorflow model in C api (for example - faster_rcnn/resnet101_v1_640x640). I loaded it using: TF_LoadSessionFromSavedModel(session_options, run_options, name, &tag, 1, graph, meta_graph, status); I printed out all…
2
votes
1 answer

TensorFlow C API Logging Setting

I am trying to suppress the logging of the tensorflow in C-API when it loads a saved model. The logging looks like this 2020-07-24 13:06:39.805191: I tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from:…
philgun
  • 149
  • 8
2
votes
1 answer

C char array from python string

I have a list of strings in python which I'm trying to pass down to a C extension for character analysis. I've gotten so far as to have the list broken up into their individual string PyObjects. Next, I'm hoping to split these strings into their…
Michael Green
  • 719
  • 6
  • 15
1
2
3
10 11