#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Explanation: Copyright 2020 The TensorFlow Authors.
End of explanation
"""


!pip install -U tensorflow-addons

import tensorflow as tf
import tensorflow_addons as tfa

"""
Explanation: Title
<table class="tfa-notebook-buttons" align="left">
  <td>
    <a target="_blank" href="https://www.tensorflow.org/addons/tutorials/_template"><img src="https://www.tensorflow.org/images/tf_logo_32px.png" />View on TensorFlow.org</a>
  </td>
  <td>
    <a target="_blank" href="https://colab.research.google.com/github/tensorflow/addons/blob/master/docs/tutorials/_template.ipynb"><img src="https://www.tensorflow.org/images/colab_logo_32px.png" />Run in Google Colab</a>
  </td>
  <td>
    <a target="_blank" href="https://github.com/tensorflow/addons/blob/master/docs/tutorials/_template.ipynb"><img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />View source on GitHub</a>
  </td>
      <td>
    <a href="https://storage.googleapis.com/tensorflow_docs/addons/docs/tutorials/_template.ipynb"><img src="https://www.tensorflow.org/images/download_logo_32px.png" />Download notebook</a>
  </td>
</table>

[Update button links]
Overview
[Include a paragraph or two explaining what this example demonstrates, who should be interested in it, and what you need to know before you get started.]
Setup
[Put all your imports and installs up into a setup section.]
End of explanation
"""


# Build the model
model = tf.keras.Sequential([
    tf.keras.layers.Dense(10, activation='relu', input_shape=(None, 5)),
    tf.keras.layers.Dense(3)
])

"""
Explanation: Resources

TensorFlow documentation contributor guide
TensorFlow documentation style guide
Google developer documentation style guide

Notebook style

Include the collapsed license at the top (uses the Colab "Form" mode to hide the cells).
Save the notebook with the table of contents open.
Use one H1 header for the title.
Include the button-bar immediately after the H1.
Include an overview section before any code.
Put all your installs and imports in a setup section.
Write Python 3 compatible code. You don't have to worry about Python 2 compatibility.
Keep code and text cells as brief as possible.
Avoid leaving an empty cell at the end of the notebook.

Code style

Notebooks are for people. Write code optimized for clarity.
Keep examples quick. Use small datasets, or small slices of datasets. Don't train to convergence, train until it's obvious it's making progress.
Demonstrate small parts before combining them into something more complex, like this:
End of explanation
"""


import numpy as np

result = model(tf.constant(np.random.randn(10,5), dtype = tf.float32)).numpy()

print("min:", result.min())
print("max:", result.max())
print("mean:", result.mean())
print("shape:", result.shape)

"""
Explanation: Run the model on a single batch of data, and inspect the output:
End of explanation
"""


model.compile(optimizer=tf.keras.optimizers.Adam(),
              loss=tf.keras.losses.categorical_crossentropy)

"""
Explanation: Compile the model for training:
End of explanation
"""


