Skip to content

Commit

Permalink
* Keep a reference of tensorflow.SessionOptions in `AbstractSessio…
Browse files Browse the repository at this point in the history
…n` to prevent premature deallocation (pull #297)
  • Loading branch information
saudet committed Oct 12, 2016
1 parent ef9728d commit 8fc317e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Keep a reference of `tensorflow.SessionOptions` in `AbstractSession` to prevent premature deallocation ([pull #297](https://github.com/bytedeco/javacpp-presets/pull/297))
* Enable CUDA in `cppbuild.sh` script for TensorFlow ([issue #294](https://github.com/bytedeco/javacpp-presets/issues/294))
* Bundle `libgomp.so.1` in JAR files of OpenCV for the sake of some Linux distributions ([issue bytedeco/javacv#436](https://github.com/bytedeco/javacv/issues/436))
* Fix `linux-armhf` and `linux-ppc64le` builds for all presets ([pull #279](https://github.com/bytedeco/javacpp-presets/pull/279))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,13 @@ public StringArray createStringArray() {

public static abstract class AbstractSession extends Pointer {
static { Loader.load(); }

SessionOptions options; // a reference to prevent deallocation

public AbstractSession(Pointer p) { super(p); }
/** Calls {@link org.bytedeco.javacpp.tensorflow#NewSession(SessionOptions)} and registers a deallocator. */
public AbstractSession(SessionOptions options) {
this.options = options;
if (NewSession(options, (Session)this).ok() && !isNull()) {
deallocator(new DeleteDeallocator((Session)this));
}
Expand Down

0 comments on commit 8fc317e

Please sign in to comment.