Path: blob/master/Conditional-GAN-PyTorch-TensorFlow/TensorFlow/CGAN-RockPaperScissor-TensorFlow.ipynb
3150 views
Kernel: Python 3 (ipykernel)
In [64]:
In [2]:
Out[2]:
2021-07-11 08:00:07.382030: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-07-11 08:00:07.535973: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
2021-07-11 08:00:07.605501: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:07.606139: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 5.94GiB deviceMemoryBandwidth: 178.99GiB/s
2021-07-11 08:00:07.606186: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-07-11 08:00:07.609138: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-07-11 08:00:07.609190: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2021-07-11 08:00:07.610286: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-07-11 08:00:07.610549: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-07-11 08:00:07.931866: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-07-11 08:00:07.934506: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2021-07-11 08:00:07.934959: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-07-11 08:00:07.935241: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:07.936707: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:07.959750: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-07-11 08:00:07.980821: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-07-11 08:00:07.981246: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:07.982746: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 5.94GiB deviceMemoryBandwidth: 178.99GiB/s
2021-07-11 08:00:07.982851: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-07-11 08:00:07.982948: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-07-11 08:00:07.983067: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2021-07-11 08:00:07.983133: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-07-11 08:00:07.983186: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-07-11 08:00:07.983238: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-07-11 08:00:07.983289: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2021-07-11 08:00:07.983341: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-07-11 08:00:07.983568: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:07.984977: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:07.985692: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-07-11 08:00:07.999434: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-07-11 08:00:19.725352: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-07-11 08:00:19.725372: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-07-11 08:00:19.725378: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-07-11 08:00:19.737436: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:19.737812: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:19.738151: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-07-11 08:00:19.738454: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 5545 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1)
In [3]:
In [4]:
Out[4]:
<BatchDataset shapes: ((None, 300, 300, 3), (None,)), types: (tf.uint8, tf.int64)>
In [5]:
In [6]:
Out[6]:
2021-07-11 08:00:20.839896: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
2021-07-11 08:00:20.870090: I tensorflow/core/platform/profile_utils/cpu_utils.cc:112] CPU Frequency: 2199995000 Hz
In [7]:
In [8]:
Out[8]:
(128, 128, 128, 3)
In [9]:
In [10]:
In [11]:
In [12]:
In [13]:
In [14]:
Out[14]:
Model: "model"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_2 (InputLayer) [(None, 100)] 0
__________________________________________________________________________________________________
input_1 (InputLayer) [(None, 1)] 0
__________________________________________________________________________________________________
dense_1 (Dense) (None, 8192) 827392 input_2[0][0]
__________________________________________________________________________________________________
embedding (Embedding) (None, 1, 100) 300 input_1[0][0]
__________________________________________________________________________________________________
re_lu (ReLU) (None, 8192) 0 dense_1[0][0]
__________________________________________________________________________________________________
dense (Dense) (None, 1, 16) 1616 embedding[0][0]
__________________________________________________________________________________________________
reshape_1 (Reshape) (None, 4, 4, 512) 0 re_lu[0][0]
__________________________________________________________________________________________________
reshape (Reshape) (None, 4, 4, 1) 0 dense[0][0]
__________________________________________________________________________________________________
concatenate (Concatenate) (None, 4, 4, 513) 0 reshape_1[0][0]
reshape[0][0]
__________________________________________________________________________________________________
conv_transpose_1 (Conv2DTranspo (None, 8, 8, 512) 4202496 concatenate[0][0]
__________________________________________________________________________________________________
bn_1 (BatchNormalization) (None, 8, 8, 512) 2048 conv_transpose_1[0][0]
__________________________________________________________________________________________________
relu_1 (ReLU) (None, 8, 8, 512) 0 bn_1[0][0]
__________________________________________________________________________________________________
conv_transpose_2 (Conv2DTranspo (None, 16, 16, 256) 2097152 relu_1[0][0]
__________________________________________________________________________________________________
bn_2 (BatchNormalization) (None, 16, 16, 256) 1024 conv_transpose_2[0][0]
__________________________________________________________________________________________________
relu_2 (ReLU) (None, 16, 16, 256) 0 bn_2[0][0]
__________________________________________________________________________________________________
conv_transpose_3 (Conv2DTranspo (None, 32, 32, 128) 524288 relu_2[0][0]
__________________________________________________________________________________________________
bn_3 (BatchNormalization) (None, 32, 32, 128) 512 conv_transpose_3[0][0]
__________________________________________________________________________________________________
relu_3 (ReLU) (None, 32, 32, 128) 0 bn_3[0][0]
__________________________________________________________________________________________________
conv_transpose_4 (Conv2DTranspo (None, 64, 64, 64) 131072 relu_3[0][0]
__________________________________________________________________________________________________
bn_4 (BatchNormalization) (None, 64, 64, 64) 256 conv_transpose_4[0][0]
__________________________________________________________________________________________________
relu_4 (ReLU) (None, 64, 64, 64) 0 bn_4[0][0]
__________________________________________________________________________________________________
conv_transpose_6 (Conv2DTranspo (None, 128, 128, 3) 3072 relu_4[0][0]
==================================================================================================
Total params: 7,791,228
Trainable params: 7,789,308
Non-trainable params: 1,920
__________________________________________________________________________________________________
In [15]:
In [16]:
In [17]:
In [18]:
Out[18]:
Model: "model_1"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_3 (InputLayer) [(None, 1)] 0
__________________________________________________________________________________________________
embedding_1 (Embedding) (None, 1, 100) 300 input_3[0][0]
__________________________________________________________________________________________________
dense_2 (Dense) (None, 1, 49152) 4964352 embedding_1[0][0]
__________________________________________________________________________________________________
input_4 (InputLayer) [(None, 128, 128, 3) 0
__________________________________________________________________________________________________
reshape_2 (Reshape) (None, 128, 128, 3) 0 dense_2[0][0]
__________________________________________________________________________________________________
concatenate_1 (Concatenate) (None, 128, 128, 6) 0 input_4[0][0]
reshape_2[0][0]
__________________________________________________________________________________________________
conv_1 (Conv2D) (None, 64, 64, 64) 6144 concatenate_1[0][0]
__________________________________________________________________________________________________
leaky_relu_1 (LeakyReLU) (None, 64, 64, 64) 0 conv_1[0][0]
__________________________________________________________________________________________________
conv_2 (Conv2D) (None, 22, 22, 128) 131072 leaky_relu_1[0][0]
__________________________________________________________________________________________________
bn_1 (BatchNormalization) (None, 22, 22, 128) 512 conv_2[0][0]
__________________________________________________________________________________________________
leaky_relu_2 (LeakyReLU) (None, 22, 22, 128) 0 bn_1[0][0]
__________________________________________________________________________________________________
conv_3 (Conv2D) (None, 8, 8, 256) 524288 leaky_relu_2[0][0]
__________________________________________________________________________________________________
bn_2 (BatchNormalization) (None, 8, 8, 256) 1024 conv_3[0][0]
__________________________________________________________________________________________________
leaky_relu_3 (LeakyReLU) (None, 8, 8, 256) 0 bn_2[0][0]
__________________________________________________________________________________________________
conv_5 (Conv2D) (None, 3, 3, 512) 2097152 leaky_relu_3[0][0]
__________________________________________________________________________________________________
bn_4 (BatchNormalization) (None, 3, 3, 512) 2048 conv_5[0][0]
__________________________________________________________________________________________________
leaky_relu_5 (LeakyReLU) (None, 3, 3, 512) 0 bn_4[0][0]
__________________________________________________________________________________________________
flatten (Flatten) (None, 4608) 0 leaky_relu_5[0][0]
__________________________________________________________________________________________________
dropout (Dropout) (None, 4608) 0 flatten[0][0]
__________________________________________________________________________________________________
dense_3 (Dense) (None, 1) 4609 dropout[0][0]
==================================================================================================
Total params: 7,731,501
Trainable params: 7,729,709
Non-trainable params: 1,792
__________________________________________________________________________________________________
In [19]:
In [20]:
In [21]:
In [22]:
Out[22]:
(3, 100)
In [23]:
In [24]:
In [25]:
In [26]:
In [27]:
In [28]:
In [29]:
In [30]:
Out[30]:
tf.float32
In [31]:
Out[31]:
[<KerasTensor: shape=(None, 128, 128, 3) dtype=float32 (created by layer 'input_4')>,
<KerasTensor: shape=(None, 1) dtype=float32 (created by layer 'input_3')>]
In [32]:
Out[32]:
[<KerasTensor: shape=(None, 100) dtype=float32 (created by layer 'input_2')>,
<KerasTensor: shape=(None, 1) dtype=float32 (created by layer 'input_1')>]
In [55]:
In [56]:
In [57]:
In [58]:
In [59]:
In [60]:
Out[60]:
(128, 100)
(128,)
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
/tmp/ipykernel_37085/1291108346.py in <module>
----> 1 train(ds, 100)
/tmp/ipykernel_37085/1721109600.py in train(dataset, epochs)
8 img = tf.cast(image_batch, tf.float32)
9 imgs = normalization(img)
---> 10 train_step(imgs,target)
11 print(epoch)
12 display.clear_output(wait=True)
~/miniconda3/envs/gan_series/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in __call__(self, *args, **kwds)
826 tracing_count = self.experimental_get_tracing_count()
827 with trace.Trace(self._name) as tm:
--> 828 result = self._call(*args, **kwds)
829 compiler = "xla" if self._experimental_compile else "nonXla"
830 new_tracing_count = self.experimental_get_tracing_count()
~/miniconda3/envs/gan_series/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds)
860 # In this case we have not created variables on the first call. So we can
861 # run the first trace but we should fail if variables are created.
--> 862 results = self._stateful_fn(*args, **kwds)
863 if self._created_variables:
864 raise ValueError("Creating variables on a non-first call to a function"
~/miniconda3/envs/gan_series/lib/python3.7/site-packages/tensorflow/python/eager/function.py in __call__(self, *args, **kwargs)
2941 filtered_flat_args) = self._maybe_define_function(args, kwargs)
2942 return graph_function._call_flat(
-> 2943 filtered_flat_args, captured_inputs=graph_function.captured_inputs) # pylint: disable=protected-access
2944
2945 @property
~/miniconda3/envs/gan_series/lib/python3.7/site-packages/tensorflow/python/eager/function.py in _call_flat(self, args, captured_inputs, cancellation_manager)
1917 # No tape is watching; skip to running the function.
1918 return self._build_call_outputs(self._inference_function.call(
-> 1919 ctx, args, cancellation_manager=cancellation_manager))
1920 forward_backward = self._select_forward_and_backward_functions(
1921 args,
~/miniconda3/envs/gan_series/lib/python3.7/site-packages/tensorflow/python/eager/function.py in call(self, ctx, args, cancellation_manager)
558 inputs=args,
559 attrs=attrs,
--> 560 ctx=ctx)
561 else:
562 outputs = execute.execute_with_cancellation(
~/miniconda3/envs/gan_series/lib/python3.7/site-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
58 ctx.ensure_initialized()
59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60 inputs, attrs, num_outputs)
61 except core._NotOkStatusException as e:
62 if name is not None:
KeyboardInterrupt:
In [39]:
In [66]:
In [67]:
In [68]:
Out[68]:
In [69]:
Out[69]:
In [ ]: