From b261385bb7212dfe33aeaeebe80b4bd209a36cbf Mon Sep 17 00:00:00 2001 From: Francois Chollet Date: Fri, 9 Jun 2023 10:55:29 -0700 Subject: [PATCH] Harcode backend in demo scripts --- examples/demo_custom_torch_workflow.py | 7 +++++++ examples/{gpu_demo_torch.py => demo_torch_multi_gpu.py} | 5 +++++ 2 files changed, 12 insertions(+) rename examples/{gpu_demo_torch.py => demo_torch_multi_gpu.py} (98%) diff --git a/examples/demo_custom_torch_workflow.py b/examples/demo_custom_torch_workflow.py index 8a0450d43..03325ae49 100644 --- a/examples/demo_custom_torch_workflow.py +++ b/examples/demo_custom_torch_workflow.py @@ -1,3 +1,9 @@ +# flake8: noqa +import os + +# Set backend env to torch +os.environ["KERAS_BACKEND"] = "torch" + import torch import torch.nn as nn import torch.optim as optim @@ -5,6 +11,7 @@ from keras_core import layers import keras_core import numpy as np + # Model / data parameters num_classes = 10 input_shape = (28, 28, 1) diff --git a/examples/gpu_demo_torch.py b/examples/demo_torch_multi_gpu.py similarity index 98% rename from examples/gpu_demo_torch.py rename to examples/demo_torch_multi_gpu.py index 30314fe39..7ae0f2f0a 100644 --- a/examples/gpu_demo_torch.py +++ b/examples/demo_torch_multi_gpu.py @@ -1,4 +1,9 @@ +# flake8: noqa import os + +# Set backend env to torch +os.environ["KERAS_BACKEND"] = "torch" + import torch import torch.nn as nn import torch.optim as optim