import torch


def get_data_samples(num_samples, standard_dev):
    """ Generates noisy samples of a non-linear function y = f(x), where x and y are real values.
        The num_samples parameter indicates the number of required samples.
        Returns two column vectors for x and y represented as PyTorch tensors
    """

    # Prepare samples of a nonlinear function where x is defined in the interval [-1, 1]
    x_tensor = torch.linspace(-1, 1, num_samples)

    # x_tensor is a sequence of numbers, we need to convert it into a column vector
    x_tensor.resize_(len(x_tensor), 1)

    # Define a nonlinear function y = f(x) + n  where n is observation noise. Obtain samples of the
    # y variable also as a column vector
    y_tensor = x_tensor.tanh()*x_tensor.pow(4) + standard_dev*torch.rand(x_tensor.shape)

    return x_tensor, y_tensor