Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def dense_model(X, w_h, w_h2, w_o, p_drop_input, p_drop_hidden):
X = nn.dropout(X, p_drop_input)
h = nn.rectify(cgt.dot(X, w_h))
h = nn.dropout(h, p_drop_hidden)
h2 = nn.rectify(cgt.dot(h, w_h2))
h2 = nn.dropout(h2, p_drop_hidden)
py_x = nn.softmax(cgt.dot(h2, w_o))
return py_x
def dense_model(X, w_h, w_h2, w_o, p_drop_input, p_drop_hidden):
X = nn.dropout(X, p_drop_input)
h = nn.rectify(cgt.dot(X, w_h))
h = nn.dropout(h, p_drop_hidden)
h2 = nn.rectify(cgt.dot(h, w_h2))
h2 = nn.dropout(h2, p_drop_hidden)
py_x = nn.softmax(cgt.dot(h2, w_o))
return py_x
def convnet_model(X, w, w2, w3, w4, w_o, p_drop_conv, p_drop_hidden):
l1a = nn.rectify(nn.conv2d(X, w, kernelshape=(3,3), pad=(1,1)))
l1 = nn.max_pool_2d(l1a, kernelshape=(2, 2), stride=(2,2))
l1 = nn.dropout(l1, p_drop_conv)
l2a = nn.rectify(nn.conv2d(l1, w2, kernelshape=(3,3), pad=(1,1)))
l2 = nn.max_pool_2d(l2a, kernelshape=(2, 2), stride=(2,2))
l2 = nn.dropout(l2, p_drop_conv)
l3a = nn.rectify(nn.conv2d(l2, w3, kernelshape=(3,3), pad=(1,1)))
l3b = nn.max_pool_2d(l3a, kernelshape=(2, 2), stride=(2,2))
batchsize,channels,rows,cols = l3b.shape
l3 = cgt.reshape(l3b, [batchsize, channels*rows*cols])
l3 = nn.dropout(l3, p_drop_conv)
l4 = nn.rectify(cgt.dot(l3, w4))
l4 = nn.dropout(l4, p_drop_hidden)
pyx = nn.softmax(cgt.dot(l4, w_o))
return pyx
l1a = nn.rectify(nn.conv2d(X, w, kernelshape=(3,3), pad=(1,1)))
l1 = nn.max_pool_2d(l1a, kernelshape=(2, 2), stride=(2,2))
l1 = nn.dropout(l1, p_drop_conv)
l2a = nn.rectify(nn.conv2d(l1, w2, kernelshape=(3,3), pad=(1,1)))
l2 = nn.max_pool_2d(l2a, kernelshape=(2, 2), stride=(2,2))
l2 = nn.dropout(l2, p_drop_conv)
l3a = nn.rectify(nn.conv2d(l2, w3, kernelshape=(3,3), pad=(1,1)))
l3b = nn.max_pool_2d(l3a, kernelshape=(2, 2), stride=(2,2))
batchsize,channels,rows,cols = l3b.shape
l3 = cgt.reshape(l3b, [batchsize, channels*rows*cols])
l3 = nn.dropout(l3, p_drop_conv)
l4 = nn.rectify(cgt.dot(l3, w4))
l4 = nn.dropout(l4, p_drop_hidden)
pyx = nn.softmax(cgt.dot(l4, w_o))
return pyx
def dense_model(X, w_h, w_h2, w_o, p_drop_input, p_drop_hidden):
X = nn.dropout(X, p_drop_input)
h = nn.rectify(cgt.dot(X, w_h))
h = nn.dropout(h, p_drop_hidden)
h2 = nn.rectify(cgt.dot(h, w_h2))
h2 = nn.dropout(h2, p_drop_hidden)
py_x = nn.softmax(cgt.dot(h2, w_o))
return py_x
def convnet_model(X, w, w2, w3, w4, w_o, p_drop_conv, p_drop_hidden):
l1a = nn.rectify(nn.conv2d(X, w, kernelshape=(3,3), pad=(1,1)))
l1 = nn.max_pool_2d(l1a, kernelshape=(2, 2), stride=(2,2))
l1 = nn.dropout(l1, p_drop_conv)
l2a = nn.rectify(nn.conv2d(l1, w2, kernelshape=(3,3), pad=(1,1)))
l2 = nn.max_pool_2d(l2a, kernelshape=(2, 2), stride=(2,2))
l2 = nn.dropout(l2, p_drop_conv)
l3a = nn.rectify(nn.conv2d(l2, w3, kernelshape=(3,3), pad=(1,1)))
l3b = nn.max_pool_2d(l3a, kernelshape=(2, 2), stride=(2,2))
batchsize,channels,rows,cols = l3b.shape
l3 = cgt.reshape(l3b, [batchsize, channels*rows*cols])
l3 = nn.dropout(l3, p_drop_conv)
l4 = nn.rectify(cgt.dot(l3, w4))
l4 = nn.dropout(l4, p_drop_hidden)
pyx = nn.softmax(cgt.dot(l4, w_o))
return pyx