def define_generator():

    def conv1d_block(filters, upsample=True, activation=tf.nn.relu, index=0):
        if upsample:
            model.add(layers.UpSampling1D(name=('UpSampling' + str(index)), size=2))
        model.add(layers.Conv1D(filters=filters, kernel_size=5, padding='same', name=('Conv1D' + str(index)), activation=activation))
        model.add(layers.BatchNormalization())
    model = tf.keras.models.Sequential(name='Generator')
    model.add(layers.Dense(int(316), activation=tf.nn.relu, name='NoiseToSpatial'))
    model.add(layers.BatchNormalization())
    model.add(layers.Reshape((int(316), 1)))
    conv1d_block(filters=512, upsample=True, index=0)
    conv1d_block(filters=512, upsample=True, index=1)
    conv1d_block(filters=256, upsample=True, index=2)
    conv1d_block(filters=256, upsample=True, index=3)
    conv1d_block(filters=128, upsample=False, index=4)
    conv1d_block(filters=128, upsample=False, index=5)
    conv1d_block(filters=64, upsample=False, index=6)
    conv1d_block(filters=64, upsample=False, index=7)
    conv1d_block(filters=1, upsample=False, activation=tf.nn.tanh, index=8)
    return model
def define_generator():

    def conv1d_block(filters, upsample=True, activation=tf.nn.relu, index=0):
        if upsample:
            model.add(layers.UpSampling1D(name=('UpSampling' + str(index)), size=2))
        model.add(layers.Conv1D(filters=filters, kernel_size=5, padding='same', name=('Conv1D' + str(index)), activation=activation))
        model.add(layers.BatchNormalization())
    model = tf.keras.models.Sequential(name='Generator')
    model.add(layers.Dense(int(316), activation=tf.nn.relu, name='NoiseToSpatial'))
    model.add(layers.BatchNormalization())
    model.add(layers.Reshape((int(316), 1)))
    conv1d_block(filters=512, upsample=True, index=0)
    conv1d_block(filters=512, upsample=True, index=1)
    conv1d_block(filters=256, upsample=True, index=2)
    conv1d_block(filters=256, upsample=True, index=3)
    conv1d_block(filters=128, upsample=False, index=4)
    conv1d_block(filters=128, upsample=False, index=5)
    conv1d_block(filters=64, upsample=False, index=6)
    conv1d_block(filters=64, upsample=False, index=7)
    conv1d_block(filters=1, upsample=False, activation=tf.nn.tanh, index=8)
    return model