def METHOD_NAME(data, tensor):
    """
    Factory function that returns a cached constant scalar tensor with the same
    dtype and device as the given tensor. If the input tensor is allocated in
    the pinned memory, the returned tensor will be also allocated to the pinned memory.
    :param data: Data for the return tensor.
    :param tensor: Tensor which the returned tensors will copy properties from.
    :return: Constant read-only tensor
    """
    return constant_tensor_factory(data,
                                   dtype=tensor.dtype,
                                   device=tensor.device,
                                   pin_memory=tensor.is_pinned())