Exemplo n.º 1
0
def grade_Q10():
    x = nn.Input("x")
    y = nn.Input("y")
    c1 = nn.Const(np.random.random((11, 12)))
    c2 = nn.Const(np.random.random((12, 13)))
    z = x * y - x * c2 - c1 * y + c1 * c2
    return is_same(z, 1, x=(11, 12), y=(12, 13))
def Q9(n):
    a = n
    x = nn.Input('x')
    n = nn.Const(n)
    ans = nn.Const(1)
    for i in range(a):
        ans = ans * x
    return ans
def Q8(
    A, b
):  ### how does it know x looked at syntax in grade file and does not make sense what does (x=x) at end of statement do?
    A = nn.Const(A)
    b = nn.Const(b)
    x = nn.Input('x')
    ans = A * x + b
    return ans
Exemplo n.º 4
0
def grade_Q2():
    c1 = nn.Const(np.random.random((10, )))
    c2 = nn.Const(np.random.random((10, 10)))
    return is_same(c1, 1) and is_same(c2, 1)
Exemplo n.º 5
0
def Q8(A, b):
    A = nn.Const(A)
    x = nn.Input("x")
    b = nn.Const(b)
    c = A*x+b
    return c
def grade_Q10():
    x = nn.Input("x")
    y = nn.Input("y")
    c = nn.Const(np.random.random())
    z = x * y - x * c - y * c + c * c
    return is_same(z, 10, x=None, y=None)
def grade_Q4():
    x = nn.Input("x")
    c = nn.Const(np.random.random())
    y = x * c
    return is_same(y, 1, x=None)
def grade_Q2():
    c = nn.Const(np.random.random())
    return is_same(c, 1)