AI-TensorFlow-Libtensorflow

 view release on metacpan or  search on metacpan

lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod  view on Meta::CPAN

  - `tags` must include the set of tags used to identify one MetaGraphDef in
     the SavedModel.
  - `graph` must be a graph newly allocated with TF_NewGraph().
  
  If successful, populates `graph` with the contents of the Graph and
  `meta_graph_def` with the MetaGraphDef of the loaded model.

=back

  /* From <tensorflow/c/c_api.h> */
  TF_CAPI_EXPORT extern TF_Session* TF_LoadSessionFromSavedModel(
      const TF_SessionOptions* session_options, const TF_Buffer* run_options,
      const char* export_dir, const char* const* tags, int tags_len,
      TF_Graph* graph, TF_Buffer* meta_graph_def, TF_Status* status);

=head2 TF_CloseSession

=over 2

  Close a session.
  
  Contacts any other processes associated with the session, if applicable.
  May not be called after TF_DeleteSession().

=back

  /* From <tensorflow/c/c_api.h> */
  TF_CAPI_EXPORT extern void TF_CloseSession(TF_Session*, TF_Status* status);

=head2 TF_DeleteSession

=over 2

  Destroy a session object.
  
  Even if error information is recorded in *status, this call discards all
  local resources associated with the session.  The session may not be used
  during or after this call (and the session drops its reference to the
  corresponding graph).

=back

  /* From <tensorflow/c/c_api.h> */
  TF_CAPI_EXPORT extern void TF_DeleteSession(TF_Session*, TF_Status* status);

=head2 TF_SessionRun

=over 2

  Run the graph associated with the session starting with the supplied inputs
  (inputs[0,ninputs-1] with corresponding values in input_values[0,ninputs-1]).
  
  Any NULL and non-NULL value combinations for (`run_options`,
  `run_metadata`) are valid.
  
     - `run_options` may be NULL, in which case it will be ignored; or
       non-NULL, in which case it must point to a `TF_Buffer` containing the
       serialized representation of a `RunOptions` protocol buffer.
     - `run_metadata` may be NULL, in which case it will be ignored; or
       non-NULL, in which case it must point to an empty, freshly allocated
       `TF_Buffer` that may be updated to contain the serialized representation
       of a `RunMetadata` protocol buffer.
  
  The caller retains ownership of `input_values` (which can be deleted using
  TF_DeleteTensor). The caller also retains ownership of `run_options` and/or
  `run_metadata` (when not NULL) and should manually call TF_DeleteBuffer on
  them.
  
  On success, the tensors corresponding to outputs[0,noutputs-1] are placed in
  output_values[]. Ownership of the elements of output_values[] is transferred
  to the caller, which must eventually call TF_DeleteTensor on them.
  
  On failure, output_values[] contains NULLs.

=back

  /* From <tensorflow/c/c_api.h> */
  TF_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*);

=head2 TF_SessionPRunSetup

=over 2

  Set up the graph with the intended feeds (inputs) and fetches (outputs) for a
  sequence of partial run calls.
  
  On success, returns a handle that is used for subsequent PRun calls. The
  handle should be deleted with TF_DeletePRunHandle when it is no longer
  needed.
  
  On failure, out_status contains a tensorflow::Status with an error
  message. *handle is set to nullptr.

=back

  /* From <tensorflow/c/c_api.h> */
  TF_CAPI_EXPORT extern void TF_SessionPRunSetup(
      TF_Session*,
      // Input names
      const TF_Output* inputs, int ninputs,
      // Output names
      const TF_Output* outputs, int noutputs,
      // Target operations
      const TF_Operation* const* target_opers, int ntargets,
      // Output handle
      const char** handle,
      // Output status
      TF_Status*);

lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod  view on Meta::CPAN


=back

  /* From <tensorflow/c/ops.h> */
  TF_CAPI_EXPORT extern void TF_DeleteShapeHandle(TF_ShapeHandle* handle);

=head2 TF_DeleteDimensionHandle

=over 2

  Frees the given dimension handle.

=back

  /* From <tensorflow/c/ops.h> */
  TF_CAPI_EXPORT extern void TF_DeleteDimensionHandle(TF_DimensionHandle* handle);

=head2 TF_CreateDir

=over 2

  Creates the specified directory. Typical status code are:
   * TF_OK - successfully created the directory
   * TF_ALREADY_EXISTS - directory already exists
   * TF_PERMISSION_DENIED - dirname is not writable

=back

  /* From <tensorflow/c/env.h> */
  TF_CAPI_EXPORT extern void TF_CreateDir(const char* dirname, TF_Status* status);

=head2 TF_DeleteDir

=over 2

  Deletes the specified directory. Typical status codes are:
   * TF_OK - successfully deleted the directory
   * TF_FAILED_PRECONDITION - the directory is not empty

=back

  /* From <tensorflow/c/env.h> */
  TF_CAPI_EXPORT extern void TF_DeleteDir(const char* dirname, TF_Status* status);

=head2 TF_DeleteRecursively

=over 2

  Deletes the specified directory and all subdirectories and files underneath
  it. This is accomplished by traversing the directory tree rooted at dirname
  and deleting entries as they are encountered.
  
  If dirname itself is not readable or does not exist, *undeleted_dir_count is
  set to 1, *undeleted_file_count is set to 0 and an appropriate status (e.g.
  TF_NOT_FOUND) is returned.
  
  If dirname and all its descendants were successfully deleted, TF_OK is
  returned and both error counters are set to zero.
  
  Otherwise, while traversing the tree, undeleted_file_count and
  undeleted_dir_count are updated if an entry of the corresponding type could
  not be deleted. The returned error status represents the reason that any one
  of these entries could not be deleted.
  
  Typical status codes:
   * TF_OK - dirname exists and we were able to delete everything underneath
   * TF_NOT_FOUND - dirname doesn't exist
   * TF_PERMISSION_DENIED - dirname or some descendant is not writable
   * TF_UNIMPLEMENTED - some underlying functions (like Delete) are not
     implemented

=back

  /* From <tensorflow/c/env.h> */
  TF_CAPI_EXPORT extern void TF_DeleteRecursively(const char* dirname,
                                                  int64_t* undeleted_file_count,
                                                  int64_t* undeleted_dir_count,
                                                  TF_Status* status);

=head2 TF_FileStat

=over 2

  Obtains statistics for the given path. If status is TF_OK, *stats is
  updated, otherwise it is not touched.

=back

  /* From <tensorflow/c/env.h> */
  TF_CAPI_EXPORT extern void TF_FileStat(const char* filename,
                                         TF_FileStatistics* stats,
                                         TF_Status* status);

=head2 TF_NewWritableFile

=over 2

  Creates or truncates the given filename and returns a handle to be used for
  appending data to the file. If status is TF_OK, *handle is updated and the
  caller is responsible for freeing it (see TF_CloseWritableFile).

=back

  /* From <tensorflow/c/env.h> */
  TF_CAPI_EXPORT extern void TF_NewWritableFile(const char* filename,
                                                TF_WritableFileHandle** handle,
                                                TF_Status* status);

=head2 TF_CloseWritableFile

=over 2

  Closes the given handle and frees its memory. If there was a problem closing
  the file, it is indicated by status. Memory is freed in any case.

=back

  /* From <tensorflow/c/env.h> */
  TF_CAPI_EXPORT extern void TF_CloseWritableFile(TF_WritableFileHandle* handle,
                                                  TF_Status* status);

=head2 TF_SyncWritableFile

=over 2

  Syncs content of the handle to the filesystem. Blocks waiting for the
  filesystem to indicate that the content has been persisted.

=back

  /* From <tensorflow/c/env.h> */
  TF_CAPI_EXPORT extern void TF_SyncWritableFile(TF_WritableFileHandle* handle,
                                                 TF_Status* status);

=head2 TF_FlushWritableFile

=over 2

  Flush local buffers to the filesystem. If the process terminates after a
  successful flush, the contents may still be persisted, since the underlying
  filesystem may eventually flush the contents.  If the OS or machine crashes
  after a successful flush, the contents may or may not be persisted, depending
  on the implementation.

=back

  /* From <tensorflow/c/env.h> */
  TF_CAPI_EXPORT extern void TF_FlushWritableFile(TF_WritableFileHandle* handle,
                                                  TF_Status* status);

=head2 TF_AppendWritableFile

=over 2

  Appends the given bytes to the file. Any failure to do so is indicated in
  status.

=back

lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod  view on Meta::CPAN


=back

  /* From <tensorflow/c/kernels_experimental.h> */
  TF_CAPI_EXPORT extern void TF_AssignRefVariable(
      TF_OpKernelContext* ctx, int input_ref_index, int output_ref_index,
      int value_index, bool use_locking, bool validate_shape,
      void (*copyFunc)(TF_OpKernelContext* ctx, TF_Tensor* source,
                       TF_Tensor* dest),
      TF_Status* status);

=head2 TF_AssignUpdateVariable

=over 2

  Expose higher level AssignUpdate operation for Pluggable vendors to implement
  in the plugin for Training. The API takes in the context with indices for the
  input and value tensors. It also accepts the copy callback provided by
  pluggable vendor to do the copying of the tensors and the update callback to
  apply the arithmetic operation. The caller takes ownership of the `source`,
  `dest`, `tensor` and `value` tensors and is responsible for freeing them with
  TF_DeleteTensor.

=back

  /* From <tensorflow/c/kernels_experimental.h> */
  TF_CAPI_EXPORT extern void TF_AssignUpdateVariable(
      TF_OpKernelContext* ctx, int input_index, int value_index, int Op,
      int isVariantType,
      void (*copyFunc)(TF_OpKernelContext* ctx, TF_Tensor* source,
                       TF_Tensor* dest),
      void (*updateFunc)(TF_OpKernelContext* ctx, TF_Tensor* tensor,
                         TF_Tensor* value, int Op),
      TF_Status* status);

=head2 TF_MaybeLockVariableInputMutexesInOrder

=over 2

  This is a helper function which acquires mutexes in-order to provide
  thread-safe way of performing weights update during the optimizer op. It
  returns an opaque LockHolder handle back to plugin. This handle is passed to
  the Release API for releasing the locks when the weight update is done. The
  caller takes ownership of the `source` and `dest` tensors and is responsible
  for freeing them with TF_DeleteTensor.

=back

  /* From <tensorflow/c/kernels_experimental.h> */
  TF_CAPI_EXPORT extern void TF_MaybeLockVariableInputMutexesInOrder(
      TF_OpKernelContext* ctx, bool do_lock, bool sparse, const int* const inputs,
      size_t len,
      void (*copyFunc)(TF_OpKernelContext* ctx, TF_Tensor* source,
                       TF_Tensor* dest),
      TF_VariableInputLockHolder** lockHolder, TF_Status* status);

=head2 TF_GetInputTensorFromVariable

=over 2

  This interface returns `out` tensor which is updated corresponding to the
  variable passed with input index. The caller takes ownership of the `source`
  and `dest` tensors and is responsible for freeing them with TF_DeleteTensor.

=back

  /* From <tensorflow/c/kernels_experimental.h> */
  TF_CAPI_EXPORT extern void TF_GetInputTensorFromVariable(
      TF_OpKernelContext* ctx, int input, bool lock_held, bool isVariantType,
      bool sparse,
      void (*copyFunc)(TF_OpKernelContext* ctx, TF_Tensor* source,
                       TF_Tensor* dest),
      TF_Tensor** out, TF_Status* status);

=head2 TF_OpKernelContext_ForwardRefInputToRefOutput

=over 2

  This interface forwards the reference from input to the output tensors
  corresponding to the indices provided with `input_index` and `output_index`

=back

  /* From <tensorflow/c/kernels_experimental.h> */
  TF_CAPI_EXPORT extern void TF_OpKernelContext_ForwardRefInputToRefOutput(
      TF_OpKernelContext* ctx, int32_t input_index, int32_t output_index);

=head2 TF_ReleaseVariableInputLockHolder

=over 2

  The API releases the opaque lock handle returned with
  `TF_MaybeLockVariableInputMutexesInOrder` API

=back

  /* From <tensorflow/c/kernels_experimental.h> */
  TF_CAPI_EXPORT extern void TF_ReleaseVariableInputLockHolder(
      TF_VariableInputLockHolder* lockHolder);

=head2 TF_GetInputByName

=over 2

  Allows plugin to get TF_Tensor when passed its input_name

=back

  /* From <tensorflow/c/kernels_experimental.h> */
  TF_CAPI_EXPORT extern void TF_GetInputByName(TF_OpKernelContext* ctx,
                                               const char* inputName,
                                               TF_Tensor** tensor,
                                               TF_Status* status);

=head2 TF_OpKernelConstruction_GetAttrTensorShape

=over 2

  Interprets the named kernel construction attribute as a shape attribute and
  fills in `vals` with the size of each dimension. `vals` must point to an
  array of length at least `max_values` (ideally set to total_size from

lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod  view on Meta::CPAN

  that lower level device queues (like GPU streams) have been flushed.
  
  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

lib/AI/TensorFlow/Libtensorflow/Manual/CAPI.pod  view on Meta::CPAN


=head2 TF_NewAttrBuilder

=over 2

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT extern TF_AttrBuilder* TF_NewAttrBuilder(const char* op_name);

=head2 TF_DeleteAttrBuilder

=over 2

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT extern void TF_DeleteAttrBuilder(TF_AttrBuilder* builder);

=head2 TF_AttrBuilderSetType

=over 2

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT extern void TF_AttrBuilderSetType(TF_AttrBuilder* builder,
                                                   const char* attr_name,
                                                   TF_DataType value);

=head2 TF_AttrBuilderSetTypeList

=over 2

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT extern void TF_AttrBuilderSetTypeList(TF_AttrBuilder* builder,
                                                       const char* attr_name,
                                                       const TF_DataType* values,
                                                       int num_values);

=head2 TF_AttrBuilderCheckCanRunOnDevice

=over 2

  Checks the tensorflow::NodeDef built via the methods above to see if it can
  run on device_type.

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT extern void TF_AttrBuilderCheckCanRunOnDevice(
      TF_AttrBuilder* builder, const char* device_type, TF_Status* status);

=head2 TF_GetNumberAttrForOpListInput

=over 2

  For argument number input_index, fetch the corresponding number_attr that
  needs to be updated with the argument length of the input list.
  Returns nullptr if there is any problem like op_name is not found, or the
  argument does not support this attribute type.

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT extern const char* TF_GetNumberAttrForOpListInput(
      const char* op_name, int input_index, TF_Status* status);

=head2 TF_OpIsStateful

=over 2

  Returns 1 if the op is stateful, 0 otherwise. The return value is undefined
  if the status is not ok.

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT extern int TF_OpIsStateful(const char* op_type,
                                            TF_Status* status);

=head2 TF_InitMain

=over 2

  Platform specific initialization routine. Very few platforms actually require
  this to be called.

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT void TF_InitMain(const char* usage, int* argc, char*** argv);

=head2 TF_PickUnusedPortOrDie

=over 2

  Platform-specific implementation to return an unused port. (This should used
  in tests only.)

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT int TF_PickUnusedPortOrDie(void);

=head2 TFE_NewTensorHandleFromScalar

=over 2

  Fast path method that makes constructing a single scalar tensor require less
  overhead and copies.

=back

  /* From <tensorflow/c/c_api_experimental.h> */
  TF_CAPI_EXPORT extern TFE_TensorHandle* TFE_NewTensorHandleFromScalar(
      TF_DataType data_type, void* data, size_t len, TF_Status* status);

=head2 TFE_EnableCollectiveOps



( run in 2.326 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )