Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def compute_gradient(y, g_y):
gmp = gradient.grad_sources_inputs( \
[(y,g_y)], clean_inputs, False)
def zero(p):
try:
use_dtype = p.type.dtype
except:
use_dtype = theano.config.floatX
return tensor.TensorConstant(tensor.TensorType(\
dtype=use_dtype, broadcastable=[]),
safe_asarray._asarray(0,dtype = use_dtype))
return [gmp.get(p, zero(p)) for p in s_inputs]