Commit c4ba26b4 authored by Jonathan Huang's avatar Jonathan Huang Committed by Sergio Guadarrama
Browse files

Cast regularization parameters to float. (#1707)

This works around a bug in earlier proto versions
that automatically infer these values to be integer
instead of float.
parent 434c2776
......@@ -111,9 +111,9 @@ def _build_regularizer(regularizer):
"""
regularizer_oneof = regularizer.WhichOneof('regularizer_oneof')
if regularizer_oneof == 'l1_regularizer':
return slim.l1_regularizer(scale=regularizer.l1_regularizer.weight)
return slim.l1_regularizer(scale=float(regularizer.l1_regularizer.weight))
if regularizer_oneof == 'l2_regularizer':
return slim.l2_regularizer(scale=regularizer.l2_regularizer.weight)
return slim.l2_regularizer(scale=float(regularizer.l2_regularizer.weight))
raise ValueError('Unknown regularizer function: {}'.format(regularizer_oneof))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment