xl-sr/CAL

ValueError: Shape must be rank 1 but is rank 0 for 'Batchnorm_0/cond/Reshape_4' (op: 'Reshape') with input shapes: [1,6,1,1], [].

chowkamlee81 opened this issue · 2 comments

After executing python driving_benchmark.py -c Town02 -v -n test as per your instruction, landed the error below. Kindly suggest how to proceed...

Built Task Block 0_red_light
Traceback (most recent call last):
File "driving_benchmark.py", line 72, in
agent = CAL(args.city_name)
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/CAL_agent.py", line 65, in init
self.neural_net = CAL_network()
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/perception/cal_network.py", line 83, in init
self.model = ModelSingle()
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/perception/cal_network.py", line 21, in init
tup = reload_model_from_episode('full_model_ep_3936')
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/perception/model_functions.py", line 58, in reload_model_from_episode
model = get_final_model()
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/perception/model_functions.py", line 316, in get_final_model
b1, p1 = get_task_block(HAZARD_STOP)
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/perception/model_functions.py", line 197, in get_task_block
model, name = reload_model_from_episode(model_name)
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/perception/model_functions.py", line 61, in reload_model_from_episode
model = get_model_master(params)
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/perception/model_functions.py", line 152, in get_model_master
model = vgg_to_timedistributed('VGG16', dilated_seq_len, conv_dp)
File "/home/deepaknayak/Documents/Reinforcement-learning/CAL/PythonClient/agents/CAL_agent/perception/model_functions.py", line 98, in vgg_to_timedistributed
x = TimeDistributed(BatchNormalization(axis=1), name='Batchnorm
{}'.format(i))(x)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/keras/engine/base_layer.py", line 457, in call
output = self.call(inputs, **kwargs)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/keras/layers/wrappers.py", line 248, in call
y = self.layer.call(inputs, **kwargs)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/keras/layers/normalization.py", line 206, in call
training=training)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 3123, in in_train_phase
x = switch(training, x, alt)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 3058, in switch
else_expression_fn)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
return func(*args, **kwargs)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2057, in cond
orig_res_f, res_f = context_f.BuildCondBranch(false_fn)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1895, in BuildCondBranch
original_result = fn()
File "/home/deepaknayak/.local/lib/python2.7/site-packages/keras/layers/normalization.py", line 167, in normalize_inference
epsilon=self.epsilon)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 1908, in batch_normalization
mean = tf.reshape(mean, (-1))
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 6199, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/framework
/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
return func(*args, **kwargs)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3155, in create_op
op_def=op_def)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1731, in init
control_input_ops)
File "/home/deepaknayak/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1579, in _create_c_op
raise ValueError(str(e))
ValueError: Shape must be rank 1 but is rank 0 for 'Batchnorm_0/cond/Reshape_4' (op: 'Reshape') with input shapes: [1,6,1,1], [].

pip uninstall keras
pip install -I keras==2.1.6
Solution works.

Solution works.