ERROR: Output should be scalar; gradients are not defined for output

using Flux

W_1 = rand(2)

W_2 = rand(2)

W_3 = rand(2)
b_1 = rand(2)

b_2 = rand(1)
function z(x,t)
return (W_1x+W_2t+b_1)
end

function sigmod(u)
return 1/(1+exp(-u))
end

function g_u(x,t)
return sum([sigmod(z(x,t)[1]) sigmod(z(x,t)[2])]*W_3+b_2)
end

x,t = rand(1,1), rand(1,1)
dg_u(x,t) = gradient(g_u,x,t)[1]
ddg_u(x,t) = gradient(dg_u,x,t)[1]
ERROR: Output should be scalar; gradients are not defined for output

How do we solve this second derivative problem???