message: Make tf.size() with optimize=True encode 0 if any dimension is 0.
diff: @@ -401,8 +401,11 @@ def size_internal(input, name=None, optimize=True, out_type=dtypes.int32):
  else:
  input_tensor = ops.convert_to_tensor(input)
  input_shape = input_tensor.get_shape()
  - if optimize and input_shape.is_fully_defined():
  + if optimize:
  + if input_shape.is_fully_defined():
  return constant(input_shape.num_elements(), out_type, name=name)
  + if input_shape.dims and any(dim == 0 for dim in input_shape.dims):
  + return constant(0, out_type, name=name)
  return gen_array_ops.size(input, name=name, out_type=out_type)
  