Add dtype to convert_to_tensor

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2018-09-24 05:51:09 +00:00
parent c475edf951
commit 7f51123b0e

View File

@ -55,7 +55,7 @@ class L1L2(Regularizer):
self.l2 = K.cast_to_floatx(l2)
def __call__(self, x):
regularization = ops.convert_to_tensor(0.)
regularization = ops.convert_to_tensor(0., dtype=K.floatx())
if self.l1:
regularization += math_ops.reduce_sum(self.l1 * math_ops.abs(x))
if self.l2: