0

I am currently getting an error: TypeError: object of type 'NoneType' has no len() when compiling my code, and I am not sure where the error is coming from.

Basically what I am trying to do is implement an Autoencoder in Keras that performs an arbitrary operation on the output of the encoder as the decoder. It is not feasible to implement the code in tf_render_vst using tensorflow operations. I have all the code written but I don't understand why it will not work. Is this possible? - my code so far is pasted below:

def tf_render_vst(x):
    return tf.py_func(render_vst, [x], tf.float32)

def render_vst(x):
    patch = rt.label_to_patch(x, fixed_params)
    audio = rt.render_patch(patch, vst_path, render_config)
    spect = rt.stft(audio)
    return spect


input_img = Input(shape=(input_shape))

# encoding Layers
...
x = Dense(output_shape, activation='linear')(x)
encoded = Activation(soft_quantization)(x)

# Decoding Layer (render patch)
decoded = Lambda(tf_render_vst, trainable = False)(encoded)

# Full Model
autoencoder = Model(input_img, decoded)

# First Half of Autoencoder - the bit I'm interested in
encoder = Model(input_spec, encoded)

autoencoder.compile(optimizer='adadelta', loss='binary_crossentropy')

Thank you in advance!

Edit: Here is the error message -

~/.local/lib/python3.5/site-packages/keras/engine/training.py in compile(self, optimizer, loss, metrics, loss_weights, sample_weight_mode, weighted_metrics, target_tensors, **kwargs) 720 if target is None or K.is_placeholder(target): 721 if target is None: --> 722 target = K.placeholder(ndim=len(shape), 723 name=name + '_target', 724 sparse=K.is_sparse(self.outputs[i]),

TypeError: object of type 'NoneType' has no len()

0 Answers0