Don't recompute "as_dtype" in backprop._ones
PiperOrigin-RevId: 238321327
This commit is contained in:
parent
cdb7884729
commit
ec35b04906
@ -624,13 +624,14 @@ def _zeros(shape, dtype):
|
|||||||
|
|
||||||
|
|
||||||
def _ones(shape, dtype):
|
def _ones(shape, dtype):
|
||||||
if dtypes.as_dtype(dtype) == dtypes.string:
|
as_dtype = dtypes.as_dtype(dtype)
|
||||||
|
if as_dtype == dtypes.string:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not context.context().executing_eagerly():
|
if not context.context().executing_eagerly():
|
||||||
return array_ops.ones(shape, dtype)
|
return array_ops.ones(shape, dtype)
|
||||||
|
|
||||||
if dtypes.as_dtype(dtype).is_bool:
|
if as_dtype.is_bool:
|
||||||
value = True
|
value = True
|
||||||
else:
|
else:
|
||||||
value = 1
|
value = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user