python.pkgs.tensorflow: add more sanity checks
This commit is contained in:
parent
6832f1da6a
commit
e4378d4641
1 changed files with 20 additions and 1 deletions
|
@ -384,7 +384,26 @@ in buildPythonPackage {
|
|||
# TODO try to run them anyway
|
||||
# TODO better test (files in tensorflow/tools/ci_build/builds/*test)
|
||||
checkPhase = ''
|
||||
${python.interpreter} -c "import tensorflow"
|
||||
${python.interpreter} <<EOF
|
||||
# A simple "Hello world"
|
||||
import tensorflow as tf
|
||||
hello = tf.constant("Hello, world!")
|
||||
sess = tf.Session()
|
||||
sess.run(hello)
|
||||
|
||||
# Fit a simple model to random data
|
||||
import numpy as np
|
||||
np.random.seed(0)
|
||||
tf.random.set_random_seed(0)
|
||||
model = tf.keras.models.Sequential([
|
||||
tf.keras.layers.Dense(1, activation="linear")
|
||||
])
|
||||
model.compile(optimizer="sgd", loss="mse")
|
||||
|
||||
x = np.random.uniform(size=(1,1))
|
||||
y = np.random.uniform(size=(1,))
|
||||
model.fit(x, y, epochs=1)
|
||||
EOF
|
||||
'';
|
||||
|
||||
passthru.libtensorflow = bazel-build.out;
|
||||
|
|
Loading…
Reference in a new issue