def METHOD_NAME(lbann):
    """Construct LBANN model.
    Args:
        lbann (module): Module for LBANN Python frontend
    """
    # Input data
    # Note: Sum with a weights layer so that gradient checking will
    # verify that error signals are correct.
    x_weights = lbann.Weights(
        optimizer=lbann.SGD(),
        initializer=lbann.ConstantInitializer(value=0.0),
        name="input_weights",
    )
    x = lbann.Sum(
        lbann.Reshape(lbann.Input(data_field="samples"), dims=_sample_size),
        lbann.WeightsLayer(weights=x_weights, dims=_sample_size),
    )
    x_lbann = x
    # Objects for LBANN model
    obj = []
    metrics = []
    callbacks = []
    # ------------------------------------------
    # Data-parallel layout
    # ------------------------------------------
    # LBANN implementation
    w = lbann.Weights(
        optimizer=lbann.SGD(),
        initializer=lbann.ConstantInitializer(value=0.0),
        name="grid1_dataparallel_weights",
    )
    w = lbann.WeightsLayer(
        weights=w,
        dims=_sample_size,
        data_layout="data_parallel",
        parallel_strategy={"grid_tag": 1},
    )
    x = lbann.Identity(x_lbann, data_layout="data_parallel")
    y1 = lbann.Sin(x, data_layout="data_parallel", parallel_strategy={"grid_tag": 2})
    y2 = lbann.Square(
        y1, data_layout="data_parallel", parallel_strategy={"grid_tag": 1}
    )
    y2 = lbann.Sum(w, y2, data_layout="data_parallel")
    y3 = lbann.Scale(
        y2, constant=2, data_layout="data_parallel", parallel_strategy={"grid_tag": 2}
    )
    y = lbann.Identity(
        y3, data_layout="data_parallel", parallel_strategy={"grid_tag": 0}
    )
    z = lbann.L2Norm2(y)
    obj.append(z)
    metrics.append(lbann.Metric(z, name="data-parallel layout"))
    # NumPy implementation
    vals = []
    for i in range(num_samples()):
        x = get_sample(i).astype(np.float64)
        y = 2 * np.sin(x) ** 2
        z = tools.numpy_l2norm2(y)
        vals.append(z)
    val = np.mean(vals)
    tol = 8 * val * np.finfo(np.float32).eps
    callbacks.append(
        lbann.CallbackCheckMetric(
            metric=metrics[-1].name,
            lower_bound=val - tol,
            upper_bound=val + tol,
            error_on_failure=True,
            execution_modes="test",
        )
    )
    # ------------------------------------------
    # Model-parallel layout
    # ------------------------------------------
    # LBANN implementation
    w = lbann.Weights(
        optimizer=lbann.SGD(),
        initializer=lbann.ConstantInitializer(value=0.5),
        name="grid2_modelparallel_weights",
    )
    x = lbann.Identity(x_lbann, data_layout="model_parallel")
    y1 = lbann.Cos(x, data_layout="model_parallel", parallel_strategy={"grid_tag": 1})
    y2 = lbann.Scale(
        y1, constant=2, data_layout="model_parallel", parallel_strategy={"grid_tag": 2}
    )
    y2 = lbann.FullyConnected(
        y2, num_neurons=1, weights=w, data_layout="model_parallel"
    )
    y3 = lbann.Square(
        y2, data_layout="data_parallel", parallel_strategy={"grid_tag": 1}
    )
    y = lbann.Identity(
        y3, data_layout="data_parallel", parallel_strategy={"grid_tag": 0}
    )
    z = lbann.L2Norm2(y)
    obj.append(z)
    metrics.append(lbann.Metric(z, name="model-parallel layout"))
    # NumPy implementation
    vals = []
    for i in range(num_samples()):
        x = get_sample(i).astype(np.float64)
        y = np.sum(np.cos(x)) ** 2
        z = tools.numpy_l2norm2(y)
        vals.append(z)
    val = np.mean(vals)
    tol = 8 * val * np.finfo(np.float32).eps
    callbacks.append(
        lbann.CallbackCheckMetric(
            metric=metrics[-1].name,
            lower_bound=val - tol,
            upper_bound=val + tol,
            error_on_failure=True,
            execution_modes="test",
        )
    )
    # ------------------------------------------
    # Gradient checking
    # ------------------------------------------
    callbacks.append(lbann.CallbackCheckGradients(error_on_failure=True))
    # ------------------------------------------
    # Construct model
    # ------------------------------------------
    num_epochs = 0
    return lbann.Model(
        num_epochs,
        layers=lbann.traverse_layer_graph(x_lbann),
        objective_function=obj,
        metrics=metrics,
        callbacks=callbacks,
    )