org.ekrich.tensorflow.unsafe

Members list

Type members

Classlikes

object tensorflow

C API for TensorFlow.

C API for TensorFlow.

The API leans towards simplicity and uniformity instead of convenience since most usage will be by language specific wrappers.

Conventions:

  • We use the prefix TF_ for everything in the API.
  • Objects are always passed around as pointers to opaque structs and these structs are allocated/deallocated via the API.
  • TF_Status holds error information. It is an object type and therefore is passed around as a pointer to an opaque struct as mentioned above.
  • Every call that has a TF_Status* argument clears it on success and fills it with error info on failure.
  • unsigned char is used for booleans (instead of the 'bool' type). In C++ bool is a keyword while in C99 bool is a macro defined in stdbool.h. It is possible for the two to be inconsistent. For example, neither the C99 nor the C++11 standard force a byte size on the bool type, so the macro defined in stdbool.h could be inconsistent with the bool keyword in C++. Thus, the use of stdbool.h is avoided and unsigned char is used instead.
  • size_t is used to represent byte sizes of objects that are materialized in the address space of the calling process.
  • int is used as an index into arrays.
  • Deletion functions are safe to call on nullptr.

Questions left to address:

  • Might at some point need a way for callers to provide their own Env.
  • Maybe add TF_TensorShape that encapsulates dimension info.

Design decisions made:

  • Backing store for tensor memory has an associated deallocation function. This deallocation function will point to client code for tensors populated by the client. So the client can do things like shadowing a numpy array.
  • We do not provide TF_OK since it is not strictly necessary and we are not optimizing for convenience.
  • We make assumption that one session has one graph. This should be fine since we have the ability to run sub-graphs.
  • We could allow NULL for some arguments (e.g., NULL options arg). However since convenience is not a primary goal, we don't do this.
  • Devices are not in this API. Instead, they are created/used internally and the API just provides high level controls over the number of devices of each type.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
tensorflow.type

Enums used in the API

Enums used in the API

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object tensorflowOps

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type