Path: blob/master/Conditional-GAN-PyTorch-TensorFlow/TensorFlow/CGAN-FashionMnist-TensorFlow.ipynb
3150 views
Kernel: Python 3 (ipykernel)
In [1]:
Out[1]:
2021-07-09 16:42:22.390718: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
In [2]:
Out[2]:
2021-07-09 16:42:29.766723: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-07-09 16:42:29.767309: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
2021-07-09 16:42:29.797386: 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-09 16:42:29.797637: 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-09 16:42:29.797656: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-07-09 16:42:29.799640: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-07-09 16:42:29.799682: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2021-07-09 16:42:29.800328: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-07-09 16:42:29.800490: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-07-09 16:42:29.801700: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-07-09 16:42:29.802274: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2021-07-09 16:42:29.802368: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-07-09 16:42:29.802449: 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-09 16:42:29.802734: 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-09 16:42:29.802951: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-07-09 16:42:29.803738: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-07-09 16:42:29.803829: 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-09 16:42:29.804058: 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-09 16:42:29.804076: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-07-09 16:42:29.804092: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-07-09 16:42:29.804107: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2021-07-09 16:42:29.804122: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-07-09 16:42:29.804137: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-07-09 16:42:29.804151: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-07-09 16:42:29.804166: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2021-07-09 16:42:29.804181: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-07-09 16:42:29.804227: 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-09 16:42:29.804477: 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-09 16:42:29.804687: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-07-09 16:42:29.804710: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-07-09 16:42:30.174209: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-07-09 16:42:30.174233: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-07-09 16:42:30.174240: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-07-09 16:42:30.174402: 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-09 16:42:30.174713: 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-09 16:42:30.174985: 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-09 16:42:30.175227: 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]:
Out[3]:
In [4]:
In [5]:
In [6]:
In [7]:
In [8]:
In [9]:
In [10]:
Out[10]:
Model: "model"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_1 (InputLayer) [(None, 1)] 0
__________________________________________________________________________________________________
input_2 (InputLayer) [(None, 100)] 0
__________________________________________________________________________________________________
embedding (Embedding) (None, 1, 100) 1000 input_1[0][0]
__________________________________________________________________________________________________
dense_1 (Dense) (None, 6272) 633472 input_2[0][0]
__________________________________________________________________________________________________
dense (Dense) (None, 1, 49) 4949 embedding[0][0]
__________________________________________________________________________________________________
leaky_re_lu (LeakyReLU) (None, 6272) 0 dense_1[0][0]
__________________________________________________________________________________________________
reshape (Reshape) (None, 7, 7, 1) 0 dense[0][0]
__________________________________________________________________________________________________
reshape_1 (Reshape) (None, 7, 7, 128) 0 leaky_re_lu[0][0]
__________________________________________________________________________________________________
concatenate (Concatenate) (None, 7, 7, 129) 0 reshape[0][0]
reshape_1[0][0]
__________________________________________________________________________________________________
conv2d_transpose (Conv2DTranspo (None, 14, 14, 128) 264320 concatenate[0][0]
__________________________________________________________________________________________________
leaky_re_lu_1 (LeakyReLU) (None, 14, 14, 128) 0 conv2d_transpose[0][0]
__________________________________________________________________________________________________
conv2d_transpose_1 (Conv2DTrans (None, 28, 28, 128) 262272 leaky_re_lu_1[0][0]
__________________________________________________________________________________________________
leaky_re_lu_2 (LeakyReLU) (None, 28, 28, 128) 0 conv2d_transpose_1[0][0]
__________________________________________________________________________________________________
conv2d (Conv2D) (None, 28, 28, 1) 6273 leaky_re_lu_2[0][0]
==================================================================================================
Total params: 1,172,286
Trainable params: 1,172,286
Non-trainable params: 0
__________________________________________________________________________________________________
In [11]:
In [12]:
In [13]:
In [14]:
Out[14]:
Model: "model_1"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_4 (InputLayer) [(None, 1)] 0
__________________________________________________________________________________________________
embedding_1 (Embedding) (None, 1, 100) 1000 input_4[0][0]
__________________________________________________________________________________________________
dense_2 (Dense) (None, 1, 784) 79184 embedding_1[0][0]
__________________________________________________________________________________________________
input_5 (InputLayer) [(None, 28, 28, 1)] 0
__________________________________________________________________________________________________
reshape_2 (Reshape) (None, 28, 28, 1) 0 dense_2[0][0]
__________________________________________________________________________________________________
concatenate_1 (Concatenate) (None, 28, 28, 2) 0 input_5[0][0]
reshape_2[0][0]
__________________________________________________________________________________________________
conv2d_1 (Conv2D) (None, 14, 14, 128) 2432 concatenate_1[0][0]
__________________________________________________________________________________________________
leaky_re_lu_3 (LeakyReLU) (None, 14, 14, 128) 0 conv2d_1[0][0]
__________________________________________________________________________________________________
conv2d_2 (Conv2D) (None, 7, 7, 128) 147584 leaky_re_lu_3[0][0]
__________________________________________________________________________________________________
leaky_re_lu_4 (LeakyReLU) (None, 7, 7, 128) 0 conv2d_2[0][0]
__________________________________________________________________________________________________
flatten (Flatten) (None, 6272) 0 leaky_re_lu_4[0][0]
__________________________________________________________________________________________________
dropout (Dropout) (None, 6272) 0 flatten[0][0]
__________________________________________________________________________________________________
dense_3 (Dense) (None, 1) 6273 dropout[0][0]
==================================================================================================
Total params: 236,473
Trainable params: 236,473
Non-trainable params: 0
__________________________________________________________________________________________________
In [15]:
In [16]:
In [17]:
In [18]:
In [19]:
In [20]:
In [21]:
In [22]:
Out[22]:
tf.float32
In [23]:
Out[23]:
[<KerasTensor: shape=(None, 100) dtype=float32 (created by layer 'input_2')>,
<KerasTensor: shape=(None, 1) dtype=float32 (created by layer 'input_1')>]
In [24]:
In [25]:
In [26]:
In [27]:
In [28]:
In [29]:
Out[29]:
(25, 28, 28, 1)
Generated Images are Conditioned on Label: Ankle boot
Time for epoch 3 is 41.11063098907471 sec
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
/tmp/ipykernel_8344/2116643407.py in <module>
----> 1 train(train_dataset, 200)
/tmp/ipykernel_8344/2482271130.py in train(dataset, epochs)
6 for image_batch,target in dataset:
7 i += 1
----> 8 train_step(image_batch,target)
9 print(epoch)
10 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)
853 # In this case we have created variables on the first call, so we run the
854 # defunned version which is guaranteed to never create variables.
--> 855 return self._stateless_fn(*args, **kwds) # pylint: disable=not-callable
856 elif self._stateful_fn is not None:
857 # Release the lock early so that multiple threads can perform the call
~/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 [30]:
In [31]:
Out[31]:
<Figure size 720x720 with 0 Axes>
In [32]:
Out[32]:
In [33]:
Out[33]:
(28, 28, 1)
In [ ]: