Skip to content

Commit

Permalink
Changes for tf0.12 (GPflow#307)
Browse files Browse the repository at this point in the history
* Changes for tf0.12.

* Modified tests as well, updated readme & version.

* Update .travis.yml
  • Loading branch information
Mark van der Wilk authored and jameshensman committed Jan 11, 2017
1 parent 2049274 commit b13937d
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ install:
# Replace dep1 dep2 ... with your dependencies
- conda create -q -n test-environment python=3.5 numpy scipy pandas nose
- source activate test-environment
- pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp35-cp35m-linux_x86_64.whl
- pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp35-cp35m-linux_x86_64.whl
- python setup.py install
script:
- nosetests --nologcapture testing
2 changes: 1 addition & 1 deletion GPflow/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.


__version__ = "0.3.4"
__version__ = "0.3.5"
2 changes: 1 addition & 1 deletion GPflow/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self, input_dim, active_dims=None):
"""
Parameterized.__init__(self)
self.scoped_keys.extend(['K', 'Kdiag'])
self.input_dim = input_dim
self.input_dim = int(input_dim)
if active_dims is None:
self.active_dims = slice(input_dim)
elif type(active_dims) is slice:
Expand Down
2 changes: 1 addition & 1 deletion GPflow/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _compile(self, optimizer=None):
else:
opt_step = optimizer.minimize(self._minusF,
var_list=[self._free_vars])
init = tf.initialize_all_variables()
init = tf.global_variables_initializer()
self._session.run(init)

# build tensorflow functions for computing the likelihood
Expand Down
4 changes: 2 additions & 2 deletions GPflow/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def get_samples_df(self, samples):
end = start + self.size
samples = samples[:, start:end]
samples = samples.reshape((samples.shape[0],) + self.shape)
samples = self.transform.forward(samples)
samples = np.atleast_1d(self.transform.forward(samples))
return pd.Series([v for v in samples], name=self.long_name)

def make_tf_array(self, free_array):
Expand Down Expand Up @@ -529,7 +529,7 @@ def runnable(instance, *np_args):
storage['feed_dict_keys'] = instance.get_feed_dict_keys()
feed_dict = {}
instance.update_feed_dict(storage['feed_dict_keys'], feed_dict)
storage['session'].run(tf.initialize_all_variables(), feed_dict=feed_dict)
storage['session'].run(tf.global_variables_initializer(), feed_dict=feed_dict)
feed_dict = dict(zip(storage['tf_args'], np_args))
feed_dict[storage['free_vars']] = instance.get_free_state()
instance.update_feed_dict(storage['feed_dict_keys'], feed_dict)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GPflow implements modern Gaussian process inference for composable kernels and l
# Install

## 1) Install TensorFlow.
Please see instructions on the main TensorFlow [webpage](https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#download-and-setup). You will need version 0.11. We find that for most users pip installation is the fastest way to get going.
Please see instructions on the main TensorFlow [webpage](https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html#download-and-setup). You will need version 0.12. We find that for most users pip installation is the fastest way to get going.

## 2) install package
GPflow includes some tensorflow extensions that are compiled when you run setup.py. For those interested in modifying the source of GPflow, we recommend
Expand Down
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Release 0.3.5
- Update to work with TensorFlow 0.12.1.

# Release 0.3.4
- Changes to stop computations all being done on the default graph.
- Update list of GPflow contributors and other small changes to front page.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
package_dir={'GPflow': 'GPflow'},
py_modules=['GPflow.__init__'],
test_suite='testing',
install_requires=['numpy>=1.9', 'scipy>=0.16', 'tensorflow>=0.11.0rc1', 'pandas>=0.18.1'],
install_requires=['numpy>=1.9', 'scipy>=0.16', 'tensorflow==0.12.1', 'pandas>=0.18.1'],
classifiers=['License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: MacOS :: MacOS X',
Expand Down
6 changes: 3 additions & 3 deletions testing/test_likelihoods.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def setUp(self):
self.sess = tf.Session()
free_array = self.switched_likelihood.get_free_state()
self.switched_likelihood.make_tf_array(free_array)
self.sess.run(tf.initialize_all_variables())
self.sess.run(tf.global_variables_initializer())

def test_logp(self):
# switchedlikelihood
Expand All @@ -258,7 +258,7 @@ def test_predict_density(self):
# likelihood
rslts = []
for lik, y, f, fvar in zip(self.likelihoods, self.Y_list, self.F_list, self.Fvar_list):
self.sess.run(tf.initialize_all_variables())
self.sess.run(tf.global_variables_initializer())
with lik.tf_mode():
rslts.append(self.sess.run(lik.predict_density(f, fvar, y)))

Expand All @@ -273,7 +273,7 @@ def test_variational_expectations(self):
# likelihood
rslts = []
for lik, y, f, fvar in zip(self.likelihoods, self.Y_list, self.F_list, self.Fvar_list):
self.sess.run(tf.initialize_all_variables())
self.sess.run(tf.global_variables_initializer())
with lik.tf_mode():
rslts.append(self.sess.run(lik.variational_expectations(f, fvar, y)))

Expand Down
2 changes: 1 addition & 1 deletion testing/test_mean_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def test(self):
sess = tf.Session()
tf_array = switched_mean.get_free_state()
switched_mean.make_tf_array(tf_array)
sess.run(tf.initialize_all_variables())
sess.run(tf.global_variables_initializer())
fd = {}
switched_mean.update_feed_dict(switched_mean.get_feed_dict_keys(), fd)
with switched_mean.tf_mode():
Expand Down

0 comments on commit b13937d

Please sign in to comment.