This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch ci-docker-staging
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/ci-docker-staging by this push:
new 9c78a55 fixed keras tutorial
9c78a55 is described below
commit 9c78a55e71c2f485bffc4edbd187b7ad72fe071c
Author: Masahiro Masuda <[email protected]>
AuthorDate: Thu Mar 31 19:48:22 2022 +0900
fixed keras tutorial
---
gallery/how_to/compile_models/from_keras.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gallery/how_to/compile_models/from_keras.py
b/gallery/how_to/compile_models/from_keras.py
index 182e769..1db2779 100644
--- a/gallery/how_to/compile_models/from_keras.py
+++ b/gallery/how_to/compile_models/from_keras.py
@@ -39,6 +39,7 @@ from tvm import te
import tvm.relay as relay
from tvm.contrib.download import download_testdata
import keras
+import tensorflow as tf
import numpy as np
######################################################################
@@ -65,7 +66,7 @@ else:
weights_path = download_testdata(weights_url, weights_file, module="keras")
-keras_resnet50 = keras.applications.resnet50.ResNet50(
+keras_resnet50 = tf.keras.applications.resnet50.ResNet50(
include_top=True, weights=None, input_shape=(224, 224, 3), classes=1000
)
keras_resnet50.load_weights(weights_path)
@@ -76,7 +77,7 @@ keras_resnet50.load_weights(weights_path)
# A single cat dominates the examples!
from PIL import Image
from matplotlib import pyplot as plt
-from keras.applications.resnet50 import preprocess_input
+from tensorflow.keras.applications.resnet50 import preprocess_input
img_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true"
img_path = download_testdata(img_url, "cat.png", module="data")