# Buggy code
def sigmoid_cross_entropy_with_logits(x, label, ignore_index=kIgnoreIndex, name=None):
    """
    ${comment}

    Args:
        x(${x_type}): ${x_comment}
        label(${label_type}): ${label_comment}
        ignore_index(&{ignore_index}): ${ignore_index_comment}
        name(basestring|None): Name of the output.

    Returns:
        out(${out_type}): ${out_comment}
    """

    helper = LayerHelper("sigmoid_cross_entropy_with_logits", **locals())

    if name is None:
        out = helper.create_variable_for_type_inference(dtype=x.dtype)
    else:
        out = helper.create_variable(name=name, dtype=x.dtype, persistable=False)

    helper.append_op(
        type="sigmoid_cross_entropy_with_logits",
        inputs={"X": x, "Label": label},
        attrs={"ignore_index": ignore_index},
        outputs={"Out": out},
    )
    return out


# Traceback (ValueError)
W0114 15:51:07.217496 116714 device_context.cc:262] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 9.0, Runtime API Version: 9.0
W0114 15:51:07.217563 116714 device_context.cc:270] device: 0, cuDNN Version: 7.0.
W0114 15:51:07.217572 116714 device_context.cc:294] WARNING: device: 0. The installed Paddle is compiled with CUDNN 7.1, but CUDNN version in your machine is 7.0, which may cause serious incompatible bug. Please recompile or reinstall Paddle with compatible CUDNN version.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/paddle/anaconda2/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/home/paddle/anaconda2/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/paddle/anaconda2/lib/python2.7/site-packages/paddle/fluid/layers/io.py", line 563, in __provider_thread__
for tensors in func():
File "/home/paddle/anaconda2/lib/python2.7/site-packages/paddle/fluid/layers/io.py", line 610, in __tensor_provider__
for slots in paddle_reader():
File "/home/paddle/anaconda2/lib/python2.7/site-packages/paddle/fluid/data_feeder.py", line 287, in __reader_creator__
yield self.feed(item)
File "/home/paddle/anaconda2/lib/python2.7/site-packages/paddle/fluid/data_feeder.py", line 206, in feed
ret_dict[each_name] = each_converter.done()
File "/home/paddle/anaconda2/lib/python2.7/site-packages/paddle/fluid/data_feeder.py", line 92, in done
self._check_shape(arr.shape)
File "/home/paddle/anaconda2/lib/python2.7/site-packages/paddle/fluid/data_feeder.py", line 79, in _check_shape
format(self.shape, shape))
ValueError: Shape not match. What is defined in data layer is (-1L, 3L, 1333L, 1333L), but receive (1, 3, 800, 1205)

# Fixed code
def sigmoid_cross_entropy_with_logits(
    x, label, ignore_index=kIgnoreIndex, name=None, normalize=False
):
    """
    ${comment}

    Args:
        x(${x_type}): ${x_comment}
        label(${label_type}): ${label_comment}
        ignore_index(&{ignore_index}): ${ignore_index_comment}
        name(basestring|None): Name of the output.
        normalize(bool): If true, divide the output by the number of
            targets != ignore_index.

    Returns:
        out(${out_type}): ${out_comment}

    Examples:
        .. code-block:: python

            input = fluid.layers.data(
                name='data', shape=[10], dtype='float32')
            label = fluid.layers.data(
                name='data', shape=[10], dtype='float32')
            loss = fluid.layers.sigmoid_cross_entropy_with_logits(
                x=input,
                label=label,
                ignore_index=-1,
                normalize=True) # or False
            # loss = fluid.layers.reduce_sum(loss) # summation of loss
    """

    helper = LayerHelper("sigmoid_cross_entropy_with_logits", **locals())

    if name is None:
        out = helper.create_variable_for_type_inference(dtype=x.dtype)
    else:
        out = helper.create_variable(name=name, dtype=x.dtype, persistable=False)

    helper.append_op(
        type="sigmoid_cross_entropy_with_logits",
        inputs={"X": x, "Label": label},
        attrs={"ignore_index": ignore_index, "normalize": normalize},
        outputs={"Out": out},
    )
    return out