Skip to content

[Tensorflow] ValueError: Cannot feed value of shape (1,) for Tensor 'Inputs/InputFrame:0', which has shape '(1, 257, None, 1)' #12

@peiwenhuang27

Description

@peiwenhuang27

Environment: Google Colab, Tensorflow 2.2.0, Intel Tensorflow 2.2.0

I used a custom dataset to store the data, and used common.dataloader to load the dataset.
quantizer.calib_dataloader = common.DataLoader(dataset, batch_size=1)
Later, I input a pre-trained pb model for quantization,
and the model has an input node of shape (1, 257, None, 1).

Upon running the quantization, the following error occured:

Traceback (most recent call last):
File "main.py", line 134, in
evaluate_opt_graph.run()
File "main.py", line 116, in run
q_model = quantizer()
File "/usr/local/lib/python3.7/dist-packages/lpot/experimental/quantization.py", line 170, in call
self.strategy.traverse()
File "/usr/local/lib/python3.7/dist-packages/lpot/strategy/strategy.py", line 287, in traverse
self.baseline = self._evaluate(self.model)
File "/usr/local/lib/python3.7/dist-packages/lpot/strategy/strategy.py", line 425, in _evaluate
val = self.objective.evaluate(eval_func, model)
File "/usr/local/lib/python3.7/dist-packages/lpot/objective.py", line 213, in evaluate
acc = eval_func(model)
File "/usr/local/lib/python3.7/dist-packages/lpot/utils/create_obj_from_config.py", line 127, in eval_func
tensorboard, fp32_baseline)
File "/usr/local/lib/python3.7/dist-packages/lpot/adaptor/tensorflow.py", line 211, in evaluate
predictions = model.sess.run(output_tensor, feed_dict)
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py", line 958, in run
run_metadata_ptr)
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py", line 1157, in _run
(np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1,) for Tensor 'Inputs/InputFrame:0', which has shape '(1, 257, None, 1)'

I'm not sure why this error occurred, though I suspect it's due to the None dimension.
Is there any workaround to it without having to set the None dimension to be fixed? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions