diff options
author | 2016-11-14 15:54:33 -0800 | |
---|---|---|
committer | 2016-11-14 16:08:54 -0800 | |
commit | a374ea13c0c7b9598b5ada851b43655f895a578e (patch) | |
tree | 0eff063ac40e04115ce5c630ddf02ddbf69abe94 /tensorflow/go/version.go | |
parent | 33c61f3e5a92c371785864b14ce97386d65ade3b (diff) |
C API: Add TF_Version(), akin to __version__ in python.
Since we envision a binary release of the C-library
and other language bindings linking against it, will
be useful to have version information when any debugging
needs to be done.
There is a slight problem in that TF_VERSION_STRING
will point to the latest release when compiled from
source at HEAD - which might be confusing as the version
string will not represent true state of the libraries.
But that seems like something to be dealt with in
version.h independently of exporting this TF_Version() function.
While at it, make the version string accessible in the Go API.
TensorFlow follows semantic versioning, but parsing the version
string into MAJOR, MINOR and PATCH is left as an excercise to
the user (who can use any number of semantic version parsing
libraries out there).
Change: 139132778
Diffstat (limited to 'tensorflow/go/version.go')
-rw-r--r-- | tensorflow/go/version.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tensorflow/go/version.go b/tensorflow/go/version.go new file mode 100644 index 0000000000..c777c44bea --- /dev/null +++ b/tensorflow/go/version.go @@ -0,0 +1,23 @@ +// Copyright 2016 The TensorFlow Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tensorflow + +// #include <string.h> +// #include "tensorflow/c/c_api.h" +import "C" + +// Version returns a string describing the version of the underlying TensorFlow +// runtime. +func Version() string { return C.GoString(C.TF_Version()) } |