Skip to content

Instantly share code, notes, and snippets.

@SaraM92
Created September 26, 2020 20:41
Show Gist options
  • Save SaraM92/862877ebe074adf4259153fdad39713e to your computer and use it in GitHub Desktop.
Save SaraM92/862877ebe074adf4259153fdad39713e to your computer and use it in GitHub Desktop.
#Import needed libraries
import theano
from theano import tensor
#Define sigmoid function
def sigmoid(x):
return 1 / (1 + tensor.exp(-x))
#Creating a symbolic variable
a = tensor.dmatrix('a')
#Get sigmoid of a
sig_a = sigmoid(a)
#Apply functiom
log = theano.function([a], sig)
#Call log function for specific values
print(log([[0, 1], [-1, -2]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment