view release on metacpan or search on metacpan
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
TF_Graph* graph, const char* op_type, const char* oper_name);
=head2 TF_SetDevice
=over 2
Specify the device for `desc`. Defaults to empty, meaning unconstrained.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_SetDevice(TF_OperationDescription* desc,
const char* device);
=head2 TF_AddInput
=over 2
For inputs that take a single tensor.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_AddInput(TF_OperationDescription* desc,
TF_Output input);
=head2 TF_AddInputList
=over 2
For inputs that take a list of tensors.
inputs must point to TF_Output[num_inputs].
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_AddInputList(TF_OperationDescription* desc,
const TF_Output* inputs,
int num_inputs);
=head2 TF_AddControlInput
=over 2
Call once per control input to `desc`.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_AddControlInput(TF_OperationDescription* desc,
TF_Operation* input);
=head2 TF_ColocateWith
=over 2
Request that `desc` be co-located on the device where `op`
is placed.
Use of this is discouraged since the implementation of device placement is
subject to change. Primarily intended for internal libraries
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_ColocateWith(TF_OperationDescription* desc,
TF_Operation* op);
=head2 TF_SetAttrString
=over 2
`value` must point to a string of length `length` bytes.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_SetAttrString(TF_OperationDescription* desc,
const char* attr_name,
const void* value, size_t length);
=head2 TF_SetAttrStringList
=over 2
`values` and `lengths` each must have lengths `num_values`.
`values[i]` must point to a string of length `lengths[i]` bytes.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_SetAttrStringList(TF_OperationDescription* desc,
const char* attr_name,
const void* const* values,
const size_t* lengths,
int num_values);
=head2 TF_SetAttrInt
=over 2
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_SetAttrInt(TF_OperationDescription* desc,
const char* attr_name, int64_t value);
=head2 TF_SetAttrIntList
=over 2
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_SetAttrIntList(TF_OperationDescription* desc,
const char* attr_name,
const int64_t* values,
int num_values);
=head2 TF_SetAttrFloat
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_OperationNumInputs(TF_Operation* oper);
=head2 TF_OperationInputType
=over 2
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern TF_DataType TF_OperationInputType(TF_Input oper_in);
=head2 TF_OperationInputListLength
=over 2
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_OperationInputListLength(TF_Operation* oper,
const char* arg_name,
TF_Status* status);
=head2 TF_OperationInput
=over 2
In this code:
TF_Output producer = TF_OperationInput(consumer);
There is an edge from producer.oper's output (given by
producer.index) to consumer.oper's input (given by consumer.index).
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern TF_Output TF_OperationInput(TF_Input oper_in);
=head2 TF_OperationAllInputs
=over 2
Get list of all inputs of a specific operation. `inputs` must point to
an array of length at least `max_inputs` (ideally set to
TF_OperationNumInputs(oper)). Beware that a concurrent
modification of the graph can increase the number of inputs of
an operation.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_OperationAllInputs(TF_Operation* oper,
TF_Output* inputs,
int max_inputs);
=head2 TF_OperationOutputNumConsumers
=over 2
Get the number of current consumers of a specific output of an
operation. Note that this number can change when new operations
are added to the graph.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_OperationOutputNumConsumers(TF_Output oper_out);
=head2 TF_OperationOutputConsumers
=over 2
Get list of all current consumers of a specific output of an
operation. `consumers` must point to an array of length at least
`max_consumers` (ideally set to
TF_OperationOutputNumConsumers(oper_out)). Beware that a concurrent
modification of the graph can increase the number of consumers of
an operation. Returns the number of output consumers (should match
TF_OperationOutputNumConsumers(oper_out)).
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_OperationOutputConsumers(TF_Output oper_out,
TF_Input* consumers,
int max_consumers);
=head2 TF_OperationNumControlInputs
=over 2
Get the number of control inputs to an operation.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_OperationNumControlInputs(TF_Operation* oper);
=head2 TF_OperationGetControlInputs
=over 2
Get list of all control inputs to an operation. `control_inputs` must
point to an array of length `max_control_inputs` (ideally set to
TF_OperationNumControlInputs(oper)). Returns the number of control
inputs (should match TF_OperationNumControlInputs(oper)).
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_OperationGetControlInputs(
TF_Operation* oper, TF_Operation** control_inputs, int max_control_inputs);
=head2 TF_OperationNumControlOutputs
=over 2
Get the number of operations that have `*oper` as a control input.
Note that this number can change when new operations are added to
the graph.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_OperationNumControlOutputs(TF_Operation* oper);
=head2 TF_OperationGetControlOutputs
=over 2
Get the list of operations that have `*oper` as a control input.
`control_outputs` must point to an array of length at least
`max_control_outputs` (ideally set to
TF_OperationNumControlOutputs(oper)). Beware that a concurrent
modification of the graph can increase the number of control
outputs. Returns the number of control outputs (should match
TF_OperationNumControlOutputs(oper)).
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_OperationGetControlOutputs(
TF_Operation* oper, TF_Operation** control_outputs,
int max_control_outputs);
=head2 TF_OperationGetAttrMetadata
=over 2
Returns metadata about the value of the attribute `attr_name` of `oper`.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern TF_AttrMetadata TF_OperationGetAttrMetadata(
TF_Operation* oper, const char* attr_name, TF_Status* status);
=head2 TF_OperationGetAttrString
=over 2
Fills in `value` with the value of the attribute `attr_name`. `value` must
point to an array of length at least `max_length` (ideally set to
TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper,
attr_name)).
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_OperationGetAttrString(TF_Operation* oper,
const char* attr_name,
void* value,
size_t max_length,
TF_Status* status);
=head2 TF_OperationGetAttrStringList
=over 2
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
TF_ImportGraphDefResults* results);
=head2 TF_GraphImportGraphDefWithResults
=over 2
Import the graph serialized in `graph_def` into `graph`. Returns nullptr and
a bad status on error. Otherwise, returns a populated
TF_ImportGraphDefResults instance. The returned instance must be deleted via
TF_DeleteImportGraphDefResults().
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern TF_ImportGraphDefResults*
TF_GraphImportGraphDefWithResults(TF_Graph* graph, const TF_Buffer* graph_def,
const TF_ImportGraphDefOptions* options,
TF_Status* status);
=head2 TF_GraphImportGraphDefWithReturnOutputs
=over 2
Import the graph serialized in `graph_def` into `graph`.
Convenience function for when only return outputs are needed.
`num_return_outputs` must be the number of return outputs added (i.e. the
result of TF_ImportGraphDefOptionsNumReturnOutputs()). If
`num_return_outputs` is non-zero, `return_outputs` must be of length
`num_return_outputs`. Otherwise it can be null.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_GraphImportGraphDefWithReturnOutputs(
TF_Graph* graph, const TF_Buffer* graph_def,
const TF_ImportGraphDefOptions* options, TF_Output* return_outputs,
int num_return_outputs, TF_Status* status);
=head2 TF_GraphImportGraphDef
=over 2
Import the graph serialized in `graph_def` into `graph`.
Convenience function for when no results are needed.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_GraphImportGraphDef(
TF_Graph* graph, const TF_Buffer* graph_def,
const TF_ImportGraphDefOptions* options, TF_Status* status);
=head2 TF_GraphCopyFunction
=over 2
Adds a copy of function `func` and optionally its gradient function `grad`
to `g`. Once `func`/`grad` is added to `g`, it can be called by creating
an operation using the function's name.
Any changes to `func`/`grad` (including deleting it) done after this method
returns, won't affect the copy of `func`/`grad` in `g`.
If `func` or `grad` are already in `g`, TF_GraphCopyFunction has no
effect on them, but can establish the function->gradient relationship
between them if `func` does not already have a gradient. If `func` already
has a gradient different from `grad`, an error is returned.
`func` must not be null.
If `grad` is null and `func` is not in `g`, `func` is added without a
gradient.
If `grad` is null and `func` is in `g`, TF_GraphCopyFunction is a noop.
`grad` must have appropriate signature as described in the doc of
GradientDef in tensorflow/core/framework/function.proto.
If successful, status is set to OK and `func` and `grad` are added to `g`.
Otherwise, status is set to the encountered error and `g` is unmodified.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern void TF_GraphCopyFunction(TF_Graph* g,
const TF_Function* func,
const TF_Function* grad,
TF_Status* status);
=head2 TF_GraphNumFunctions
=over 2
Returns the number of TF_Functions registered in `g`.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_GraphNumFunctions(TF_Graph* g);
=head2 TF_GraphGetFunctions
=over 2
Fills in `funcs` with the TF_Function* registered in `g`.
`funcs` must point to an array of TF_Function* of length at least
`max_func`. In usual usage, max_func should be set to the result of
TF_GraphNumFunctions(g). In this case, all the functions registered in
`g` will be returned. Else, an unspecified subset.
If successful, returns the number of TF_Function* successfully set in
`funcs` and sets status to OK. The caller takes ownership of
all the returned TF_Functions. They must be deleted with TF_DeleteFunction.
On error, returns 0, sets status to the encountered error, and the contents
of funcs will be undefined.
=back
/* From <tensorflow/c/c_api.h> */
TF_CAPI_EXPORT extern int TF_GraphGetFunctions(TF_Graph* g, TF_Function** funcs,
int max_func, TF_Status* status);
=head2 TF_OperationToNodeDef
=over 2
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
TF_CAPI_EXPORT extern void TF_KernelBuilder_Label(
TF_KernelBuilder* kernel_builder, const char* label);
=head2 TF_RegisterKernelBuilder
=over 2
Register the given kernel builder with the TensorFlow runtime. If
registration fails, the given status will be populated.
This call takes ownership of the `builder` pointer.
=back
/* From <tensorflow/c/kernels.h> */
TF_CAPI_EXPORT extern void TF_RegisterKernelBuilder(const char* kernel_name,
TF_KernelBuilder* builder,
TF_Status* status);
=head2 TF_RegisterKernelBuilderWithKernelDef
=over 2
Register the given kernel builder with the TensorFlow runtime. If
registration fails, the given status will be populated.
This method is the same as TF_RegisterKernelBuilder except it takes in a
serialized KernelDef, and uses it for registration, instead of building a new
one. Users can choose to not provide a serialized KernelDef and in that case
it's identical to TF_RegisterKernelBuilder.
=back
/* From <tensorflow/c/kernels.h> */
TF_CAPI_EXPORT extern void TF_RegisterKernelBuilderWithKernelDef(
const char* serialized_kernel_def, const char* name,
TF_KernelBuilder* builder, TF_Status* status);
=head2 TF_DeleteKernelBuilder
=over 2
Deletes the given TF_KernelBuilder. This should be called only if the kernel
builder is not registered with TensorFlow via TF_RegisterKernelBuilder.
=back
/* From <tensorflow/c/kernels.h> */
TF_CAPI_EXPORT extern void TF_DeleteKernelBuilder(TF_KernelBuilder* builder);
=head2 TF_GetStream
=over 2
TF_GetStream returns the SP_Stream available in ctx.
This function returns a stream only for devices registered using the
StreamExecutor C API
(tensorflow/c/experimental/stream_executor/stream_executor.h). It will return
nullptr and set error status in all other cases.
Experimental: this function doesn't have compatibility guarantees and subject
to change at any time.
=back
/* From <tensorflow/c/kernels.h> */
TF_CAPI_EXPORT extern SP_Stream TF_GetStream(TF_OpKernelContext* ctx,
TF_Status* status);
=head2 TF_NumInputs
=over 2
TF_NumInputs returns the number of inputs available in ctx.
=back
/* From <tensorflow/c/kernels.h> */
TF_CAPI_EXPORT extern int TF_NumInputs(TF_OpKernelContext* ctx);
=head2 TF_NumOutputs
=over 2
TF_NumOutputs returns the number of outputs to be placed in *ctx by the
kernel.
=back
/* From <tensorflow/c/kernels.h> */
TF_CAPI_EXPORT extern int TF_NumOutputs(TF_OpKernelContext* ctx);
=head2 TF_GetInput
=over 2
Retrieves the ith input from ctx. If TF_GetCode(status) is TF_OK, *tensor is
populated and its ownership is passed to the caller. In any other case,
*tensor is not modified.
If i < 0 or i >= TF_NumInputs(ctx), *status is set to TF_OUT_OF_RANGE.
=back
/* From <tensorflow/c/kernels.h> */
TF_CAPI_EXPORT extern void TF_GetInput(TF_OpKernelContext* ctx, int i,
TF_Tensor** tensor, TF_Status* status);
=head2 TF_InputRange
=over 2
Retrieves the start and stop indices, given the input name. Equivalent to
OpKernel::InputRange(). `args` will contain the result indices and status.
=back
/* From <tensorflow/c/kernels.h> */
TF_CAPI_EXPORT extern void TF_InputRange(TF_OpKernelContext* ctx,
const char* name,
TF_InputRange_Args* args);
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
=head2 TFE_OpSetAttrFunctionList
=over 2
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern void TFE_OpSetAttrFunctionList(TFE_Op* op,
const char* attr_name,
const TFE_Op** value,
int num_values);
=head2 TFE_OpGetInputLength
=over 2
Returns the length (number of tensors) of the input argument `input_name`
found in the provided `op`.
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern int TFE_OpGetInputLength(TFE_Op* op,
const char* input_name,
TF_Status* status);
=head2 TFE_OpGetOutputLength
=over 2
Returns the length (number of tensors) of the output argument `output_name`
found in the provided `op`.
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern int TFE_OpGetOutputLength(TFE_Op* op,
const char* output_name,
TF_Status* status);
=head2 TFE_Execute
=over 2
Execute the operation defined by 'op' and return handles to computed
tensors in `retvals`.
'retvals' must point to a pre-allocated array of TFE_TensorHandle* and
'*num_retvals' should be set to the size of this array. It is an error if
the size of 'retvals' is less than the number of outputs. This call sets
*num_retvals to the number of outputs.
If async execution is enabled, the call may simply enqueue the execution
and return "non-ready" handles in `retvals`. Note that any handles contained
in 'op' should not be mutated till the kernel execution actually finishes.
For sync execution, if any of the inputs to `op` are not ready, this call
will block till they become ready and then return when the kernel execution
is done.
TODO(agarwal): change num_retvals to int from int*.
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern void TFE_Execute(TFE_Op* op, TFE_TensorHandle** retvals,
int* num_retvals, TF_Status* status);
=head2 TFE_ContextAddFunctionDef
=over 2
Add a function (serialized FunctionDef protocol buffer) to ctx so
that it can be invoked using TFE_Execute.
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern void TFE_ContextAddFunctionDef(
TFE_Context* ctx, const char* serialized_function_def, size_t size,
TF_Status* status);
=head2 TFE_ContextAddFunction
=over 2
Adds a function (created from TF_GraphToFunction or
TF_FunctionImportFunctionDef) to the context, allowing it to be executed with
TFE_Execute by creating an op with the same name as the function.
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern void TFE_ContextAddFunction(TFE_Context* ctx,
TF_Function* function,
TF_Status* status);
=head2 TFE_ContextRemoveFunction
=over 2
Removes a function from the context. Once removed, you can no longer
TFE_Execute it or TFE_Execute any TFE_Op which has it as an attribute or any
other function which calls it as an attribute.
=back
/* From <tensorflow/c/eager/c_api.h> */
TF_CAPI_EXPORT extern void TFE_ContextRemoveFunction(TFE_Context* ctx,
const char* name,
TF_Status* status);
=head2 TFE_ContextHasFunction
=over 2
Checks whether a function is registered under `name`.
=back
/* From <tensorflow/c/eager/c_api.h> */
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern TFE_MonitoringSampler2* TFE_MonitoringNewSampler2(
const char* name, TFE_MonitoringBuckets* buckets, TF_Status* out_status,
const char* description, const char* label1, const char* label2);
=head2 TFE_MonitoringDeleteSampler2
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_MonitoringDeleteSampler2(
TFE_MonitoringSampler2* sampler);
=head2 TFE_MonitoringGetCellSampler2
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern TFE_MonitoringSamplerCell* TFE_MonitoringGetCellSampler2(
TFE_MonitoringSampler2* sampler, const char* label1, const char* label2);
=head2 TFE_ContextOptionsSetTfrt
=over 2
Sets whether to use TFRT
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_ContextOptionsSetTfrt(TFE_ContextOptions*,
bool use_tfrt);
=head2 TFE_ContextOptionsSetTfrtDistributedRuntime
=over 2
Sets whether to use TFRT distributed runtime
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_ContextOptionsSetTfrtDistributedRuntime(
TFE_ContextOptions* options, bool use_tfrt_distributed_runtime);
=head2 TFE_GetContextId
=over 2
Returns the context_id from the EagerContext which is used by the
EagerService to maintain consistency between client and worker. The
context_id is initialized with a dummy value and is later set when the worker
is initialized (either locally or remotely). The context_id can change during
the process lifetime although this should cause the worker to be
reinitialized (e.g. cleared caches) as well.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern uint64_t TFE_GetContextId(TFE_Context* ctx);
=head2 TFE_NewCancellationManager
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern TFE_CancellationManager* TFE_NewCancellationManager();
=head2 TFE_CancellationManagerIsCancelled
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern bool TFE_CancellationManagerIsCancelled(
TFE_CancellationManager*);
=head2 TFE_CancellationManagerStartCancel
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_CancellationManagerStartCancel(
TFE_CancellationManager*);
=head2 TFE_DeleteCancellationManager
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_DeleteCancellationManager(
TFE_CancellationManager*);
=head2 TFE_OpSetCancellationManager
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_OpSetCancellationManager(
TFE_Op* op, TFE_CancellationManager* cancellation_manager,
TF_Status* status);
=head2 TFE_NewExecutor
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
This call may not block for execution of ops enqueued concurrently with this
call.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_ExecutorWaitForAllPendingNodes(
TFE_Executor*, TF_Status* status);
=head2 TFE_ExecutorClearError
=over 2
When an error happens, any pending operations are discarded, and newly issued
ops return an error. This call clears the error state and re-enables
execution of newly issued ops.
Note that outputs of discarded ops remain in a corrupt state and should not
be used for future calls.
TODO(agarwal): mark the affected handles and raise errors if they are used.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_ExecutorClearError(TFE_Executor*);
=head2 TFE_ContextSetExecutorForThread
=over 2
Sets a custom Executor for the current thread. All nodes created by this
thread will be added to this Executor. It will override the current executor.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_ContextSetExecutorForThread(TFE_Context*,
TFE_Executor*);
=head2 TFE_ContextGetExecutorForThread
=over 2
Returns the Executor for the current thread.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern TFE_Executor* TFE_ContextGetExecutorForThread(
TFE_Context*);
=head2 TFE_ContextUpdateServerDef
=over 2
Update an existing context with a new set of servers defined in a ServerDef
proto. Servers can be added to and removed from the list of remote workers
in the context. A New set of servers identified by the ServerDef must be up
when the context is updated.
This API is for experimental usage and may be subject to change.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_ContextUpdateServerDef(TFE_Context* ctx,
int keep_alive_secs,
const void* proto,
size_t proto_len,
TF_Status* status);
=head2 TFE_ContextCheckAlive
=over 2
Checks whether a remote worker is alive or not. This will return true even if
the context doesn't exist on the remote worker.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern bool TFE_ContextCheckAlive(TFE_Context* ctx,
const char* worker_name,
TF_Status* status);
=head2 TFE_ContextAsyncWait
=over 2
Sync pending nodes in local executors (including the context default executor
and thread executors) and streaming requests to remote executors, and get the
combined status.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_ContextAsyncWait(TFE_Context* ctx,
TF_Status* status);
=head2 TFE_TensorHandleDevicePointer
=over 2
This function will block till the operation that produces `h` has
completed. This is only valid on local TFE_TensorHandles. The pointer
returned will be on the device in which the TFE_TensorHandle resides (so e.g.
for a GPU tensor this will return a pointer to GPU memory). The pointer is
only guaranteed to be valid until TFE_DeleteTensorHandle is called on this
TensorHandle. Only supports POD data types.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void* TFE_TensorHandleDevicePointer(TFE_TensorHandle*,
TF_Status*);
=head2 TFE_TensorHandleDeviceMemorySize
=over 2
This function will block till the operation that produces `h` has
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
Serialize `attrs` as a tensorflow::NameAttrList protocol buffer (into `buf`),
containing the op name and a map of its attributes.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_OpAttrsSerialize(const TFE_OpAttrs* attrs,
TF_Buffer* buf,
TF_Status* status);
=head2 TFE_OpSetAttrValueProto
=over 2
Set an op's attribute from a serialized AttrValue protocol buffer.
Analogous to TF_SetAttrValueProto for building graph operations.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_OpSetAttrValueProto(const TFE_Op* op,
const char* attr_name,
const void* proto,
size_t proto_len,
TF_Status* status);
=head2 TFE_RegisterCustomDevice
=over 2
Registers a custom device for use with eager execution.
Eager operations may be placed on this device, e.g. `with
tf.device("CUSTOM"):` from Python if `device_name` for this call is
"/job:localhost/replica:0/task:0/device:CUSTOM:0".
The custom device defines copy operations for moving TensorHandles on and
off, and an execution operation for named operations. Often execution will
simply wrap op execution on one or more physical devices.
device_info is an opaque caller-defined type stored with the custom device
which is passed to the functions referenced in the TFE_CustomDevice struct
`device` (execute, delete_device, etc.). It can for example contain the
names of wrapped devices.
There are currently no graph semantics implemented for registered custom
devices, so executing tf.functions which contain operations placed on the
custom devices will fail.
`device_name` must not name an existing physical or custom device. It must
follow the format:
/job:<name>/replica:<replica>/task:<task>/device:<type>:<device_num>
If the device is successfully registered, `status` is set to TF_OK. Otherwise
the device is not usable. In case of a bad status, `device.delete_device` is
still called on `device_info` (i.e. the caller does not retain ownership).
This API is highly experimental, and in particular is expected to change when
it starts supporting operations with attributes and when tf.function support
is added.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_RegisterCustomDevice(TFE_Context* ctx,
TFE_CustomDevice device,
const char* device_name,
void* device_info,
TF_Status* status);
=head2 TFE_IsCustomDevice
=over 2
Returns whether `device_name` maps to a registered custom device.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern bool TFE_IsCustomDevice(TFE_Context* ctx,
const char* device_name);
=head2 TFE_NewCustomDeviceTensorHandle
=over 2
Creates a new TensorHandle from memory residing in a custom device. Takes
ownership of the memory pointed to by `tensor_handle_data`, and calls
`methods.deallocator` to release it after TF no longer needs it or in case of
an error.
This call is similar to `TFE_NewTensorHandleFromDeviceMemory`, but supports
custom devices instead of physical devices and does not require blocking
waiting for exact shapes.
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern TFE_TensorHandle* TFE_NewCustomDeviceTensorHandle(
TFE_Context*, const char* device_name, TF_DataType, void* data,
TFE_CustomDeviceTensorHandle methods, TF_Status* status);
=head2 TFE_ContextGetFunctionDef
=over 2
=back
/* From <tensorflow/c/eager/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TFE_ContextGetFunctionDef(TFE_Context* ctx,
const char* function_name,
TF_Buffer* buf,
TF_Status* status);
=head2 TFE_AllocateHostTensor
=over 2
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
Returns:
If status is not OK, returns nullptr. Otherwise, returns a
TF_ConcreteFunction instance. The lifetime of this instance is
"conceptually" bound to `model`. Once `model` is deleted, all
`TF_ConcreteFunctions` retrieved from it are invalid, and have been deleted.
=back
/* From <tensorflow/c/experimental/saved_model/public/saved_model_api.h> */
TF_CAPI_EXPORT extern TF_ConcreteFunction* TF_GetSavedModelConcreteFunction(
TF_SavedModel* model, const char* function_path, TF_Status* status);
=head2 TF_GetSavedModelSignatureDefFunction
=over 2
Retrieve a function from the TF SavedModel via a SignatureDef key.
Params:
model - The SavedModel to load a function from.
signature_def_key - The string key of the SignatureDef map of a SavedModel:
https://github.com/tensorflow/tensorflow/blob/69b08900b1e991d84bce31f3b404f5ed768f339f/tensorflow/core/protobuf/meta_graph.proto#L89
status - Set to OK on success and an appropriate error on failure.
Returns:
If status is not OK, returns nullptr. Otherwise, returns a
TF_SignatureDefFunction instance. Once `model` is deleted, all
`TF_SignatureDefFunctions` retrieved from it are invalid, and have been
deleted.
=back
/* From <tensorflow/c/experimental/saved_model/public/saved_model_api.h> */
TF_CAPI_EXPORT extern TF_SignatureDefFunction*
TF_GetSavedModelSignatureDefFunction(TF_SavedModel* model,
const char* signature_def_key,
TF_Status* status);
=head2 TF_ConcreteFunctionGetMetadata
=over 2
Returns FunctionMetadata associated with `func`. Metadata's lifetime is
bound to `func`, which is bound to the TF_SavedModel it was loaded from.
=back
/* From <tensorflow/c/experimental/saved_model/public/concrete_function.h> */
TF_CAPI_EXPORT extern TF_FunctionMetadata* TF_ConcreteFunctionGetMetadata(
TF_ConcreteFunction* func);
=head2 TF_ConcreteFunctionMakeCallOp
=over 2
Returns a TFE_Op suitable for executing this function. Caller must provide
all function inputs in `inputs`, and must not add any additional inputs on
the returned op. (i.e. don't call TFE_OpAddInput or TFE_OpAddInputList).
The caller is responsible for deleting the returned TFE_Op. If op
construction fails, `status` will be non-OK and the returned pointer will be
null.
TODO(bmzhao): Remove this function in a subsequent change; Design + implement
a Function Execution interface for ConcreteFunction that accepts a tagged
union of types (tensorflow::Value). This effectively requires moving much of
the implementation of function.py/def_function.py to C++, and exposing a
high-level API here. A strawman for what this interface could look like:
TF_Value* TF_ExecuteFunction(TFE_Context*, TF_ConcreteFunction*, TF_Value*
inputs, int num_inputs, TF_Status* status);
=back
/* From <tensorflow/c/experimental/saved_model/public/concrete_function.h> */
TF_CAPI_EXPORT extern TFE_Op* TF_ConcreteFunctionMakeCallOp(
TF_ConcreteFunction* func, TFE_TensorHandle** inputs, int num_inputs,
TF_Status* status);
=head2 TF_SignatureDefParamName
=over 2
Returns the name of the given parameter. The caller is not responsible for
freeing the returned char*.
=back
/* From <tensorflow/c/experimental/saved_model/public/signature_def_param.h> */
TF_CAPI_EXPORT extern const char* TF_SignatureDefParamName(
const TF_SignatureDefParam* param);
=head2 TF_SignatureDefParamTensorSpec
=over 2
Returns the TensorSpec associated with the given parameter. The caller is
not reponsible for freeing the returned TF_TensorSpec*.
=back
/* From <tensorflow/c/experimental/saved_model/public/signature_def_param.h> */
TF_CAPI_EXPORT extern const TF_TensorSpec* TF_SignatureDefParamTensorSpec(
const TF_SignatureDefParam* param);
=head2 TF_SignatureDefFunctionGetMetadata
=over 2
Returns FunctionMetadata associated with `func`. Metadata's lifetime is
bound to `func`, which is bound to the TF_SavedModel it was loaded from.
=back
/* From <tensorflow/c/experimental/saved_model/public/signature_def_function.h> */
TF_CAPI_EXPORT extern TF_SignatureDefFunctionMetadata*
TF_SignatureDefFunctionGetMetadata(TF_SignatureDefFunction* func);
=head2 TF_SignatureDefFunctionMakeCallOp
=over 2
Returns a TFE_Op suitable for executing this function. Caller must provide
all function inputs in `inputs`, and must not add any additional inputs on
the returned op. (i.e. don't call TFE_OpAddInput or TFE_OpAddInputList).
lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod view on Meta::CPAN
=head2 TF_GetXlaConstantFoldingDisabled
=over 2
Gets/Sets TF/XLA flag for whether(true) or not(false) to disable constant
folding. This is for testing to ensure that XLA is being tested rather than
Tensorflow's CPU implementation through constant folding.
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT unsigned char TF_GetXlaConstantFoldingDisabled();
=head2 TF_SetXlaConstantFoldingDisabled
=over 2
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT void TF_SetXlaConstantFoldingDisabled(
unsigned char should_enable);
=head2 TF_CreateConfig
=over 2
Create a serialized tensorflow.ConfigProto proto, where:
a) ConfigProto.optimizer_options.global_jit_level is set to ON_1 if
`enable_xla_compilation` is non-zero, and OFF otherwise.
b) ConfigProto.gpu_options.allow_growth is set to `gpu_memory_allow_growth`.
c) ConfigProto.device_count is set to `num_cpu_devices`.
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT extern TF_Buffer* TF_CreateConfig(
unsigned char enable_xla_compilation, unsigned char gpu_memory_allow_growth,
unsigned int num_cpu_devices);
=head2 TF_CreateRunOptions
=over 2
Create a serialized tensorflow.RunOptions proto, where RunOptions.trace_level
is set to FULL_TRACE if `enable_full_trace` is non-zero, and NO_TRACE
otherwise.
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT extern TF_Buffer* TF_CreateRunOptions(
unsigned char enable_full_trace);
=head2 TF_GraphDebugString
=over 2
Returns the graph content in a human-readable format, with length set in
`len`. The format is subject to change in the future.
The returned string is heap-allocated, and caller should call free() on it.
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT extern const char* TF_GraphDebugString(TF_Graph* graph,
size_t* len);
=head2 TF_FunctionDebugString
=over 2
Returns the function content in a human-readable format, with length set in
`len`. The format is subject to change in the future.
The returned string is heap-allocated, and caller should call free() on it.
Do not return const char*, because some foreign language binding
(e.g. swift) cannot then call free() on the returned pointer.
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT extern char* TF_FunctionDebugString(TF_Function* func,
size_t* len);
=head2 TF_DequeueNamedTensor
=over 2
Caller must call TF_DeleteTensor() over the returned tensor. If the queue is
empty, this call is blocked.
Tensors are enqueued via the corresponding TF enqueue op.
TODO(hongm): Add support for `timeout_ms`.
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT extern TF_Tensor* TF_DequeueNamedTensor(TF_Session* session,
int tensor_id,
TF_Status* status);
=head2 TF_EnqueueNamedTensor
=over 2
On success, enqueues `tensor` into a TF-managed FifoQueue given by
`tensor_id`, associated with `session`. There must be a graph node named
"fifo_queue_enqueue_<tensor_id>", to be executed by this API call. It reads
from a placeholder node "arg_tensor_enqueue_<tensor_id>".
`tensor` is still owned by the caller. This call will be blocked if the queue
has reached its capacity, and will be unblocked when the queued tensors again
drop below the capacity due to dequeuing.
Tensors are dequeued via the corresponding TF dequeue op.
TODO(hongm): Add support for `timeout_ms`.
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TF_EnqueueNamedTensor(TF_Session* session,
int tensor_id,
TF_Tensor* tensor,
TF_Status* status);
=head2 TF_MakeInternalErrorStatus
=over 2
=back
/* From <tensorflow/c/c_api_experimental.h> */
TF_CAPI_EXPORT extern void TF_MakeInternalErrorStatus(TF_Status* status,