<jupyter_start><jupyter_text><jupyter_code>import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import urllib
Image.open("/content/nvidea-end to end learning for self driving cars - archticture.png")
urllib.request.urlretrieve("https://i0.wp.com/syncedreview.com/wp-content/uploads/2017/02/image-32.png?resize=624%2C335&ssl=1","link")
Image.open("link")
%%writefile model.py

class NvidiaModel(tf.keras.Model):
  def __init__(self):
    super(NvidiaModel,self).__init__()
    self.conv2d = tf.keras.Sequential((tf.keras.layers.BatchNormalization(input_shape = (66,200,3)),
                      
                        tf.keras.layers.Conv2D(filters = 24, kernel_size = (5,5), strides = (2,2), padding = 'valid', activation = "relu"),
                        tf.keras.layers.Conv2D(filters = 36, kernel_size = (5,5), strides = (2,2), padding = 'valid', activation = 'relu'),
                        tf.keras.layers.Conv2D(filters = 48, kernel_size = (5,5), strides = (2,2), padding = 'valid', activation = 'relu'),
                        tf.keras.layers.Conv2D(filters = 64, kernel_size = (3,3), strides = (1,1), padding = 'valid', activation = 'relu'),
                        tf.keras.layers.Conv2D(filters = 64, kernel_size = (3,3), strides = (1,1), padding = 'valid', activation = 'relu'),
                        ))
    self.maxpool = tf.keras.layers.MaxPool2D(pool_size=(2,2))
    
    self.Flatten = tf.keras.layers.Flatten()
    self.fc = tf.keras.Sequential()
    self.fc.add(tf.keras.layers.Dense(1164))
    self.fc.add(tf.keras.layers.Dense(100))
    self.fc.add(tf.keras.layers.Dense(10))
    
  def call(self,image):
    image = self.conv2d(image)
    image =self.maxpool(image)
    image = self.Flatten(image)
    output = self.fc(image)

    return output
model = NvidiaModel()
input_ = np.random.randn(1,66,200,3) #initialize a random input 
model(input_)
model.summary(expand_nested = True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15380736258194655, 'fraction_numerical': 0.03983862834089763, 'mean_word_length': 3.159329140461216, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '365426', 'license': 'MIT', 'n_tokens_mistral': 735, 'n_tokens_neox': 687, 'n_words': 121, 'path': 'notebook.ipynb', 'repo_name': 'mk-armah/ev-research', 'size': '1983'}