Tutorial-SoftWeightSharingForNNCompression icon indicating copy to clipboard operation
Tutorial-SoftWeightSharingForNNCompression copied to clipboard

Help me,please!how to resolve the error?

Open Janeljj opened this issue 4 years ago • 1 comments

The error in

model.compile(optimizer = opt, loss = {"error_loss": "categorical_crossentropy", "complexity_loss": identity_objective}, loss_weights = {"error_loss": 1. , "complexity_loss": tau/N}, metrics = ["accuracy"]) #######

IndexError Traceback (most recent call last) in 10 11 ---> 12 model1.compile(optimizer = opt, 13 loss = {"error_loss": "categorical_crossentropy", "complexity_loss": identity_objective}, 14 loss_weights = {"error_loss": 1. , "complexity_loss": tau/N},

C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\training\tracking\base.py in _method_wrapper(self, *args, **kwargs) 528 self._self_setattr_tracking = False # pylint: disable=protected-access 529 try: --> 530 result = method(self, *args, **kwargs) 531 finally: 532 self._self_setattr_tracking = previous_value # pylint: disable=protected-access

~\AppData\Roaming\Python\Python38\site-packages\keras\engine\training_v1.py in compile(self, optimizer, loss, metrics, loss_weights, sample_weight_mode, weighted_metrics, target_tensors, distribute, **kwargs) 424 with backend.get_graph().as_default(): 425 # Save all metric attributes per output of the model. --> 426 self._cache_output_metric_attributes(metrics, weighted_metrics) 427 428 # Set metric attributes on model.

~\AppData\Roaming\Python\Python38\site-packages\keras\engine\training_v1.py in _cache_output_metric_attributes(self, metrics, weighted_metrics) 1786 else: 1787 output_shapes.append(output.shape.as_list()) -> 1788 self._per_output_metrics = training_utils_v1.collect_per_output_metric_info( 1789 metrics, self.output_names, output_shapes, self.loss_functions, 1790 from_serialized=self._from_serialized)

~\AppData\Roaming\Python\Python38\site-packages\keras\engine\training_utils_v1.py in collect_per_output_metric_info(metrics, output_names, output_shapes, loss_fns, from_serialized, is_weighted) 885 for metric in metrics: 886 metric_name = get_metric_name(metric, is_weighted) --> 887 metric_fn = get_metric_function( 888 metric, output_shape=output_shapes[i], loss_fn=loss_fns[i]) 889 metric_fn._from_serialized = from_serialized # pylint: disable=protected-access

~\AppData\Roaming\Python\Python38\site-packages\keras\engine\training_utils_v1.py in get_metric_function(metric, output_shape, loss_fn) 1140 1141 if metric in ['accuracy', 'acc']: -> 1142 if output_shape[len(output_shape)-1] == 1 or is_binary_crossentropy: 1143 return metrics_module.binary_accuracy 1144 elif is_sparse_categorical_crossentropy:

IndexError: list index out of range

Janeljj avatar Jan 17 '22 07:01 Janeljj

IndexError: list index out of range

Janeljj avatar Jan 17 '22 07:01 Janeljj