import TensorFlow let ten: Tensor<Float> = [0, 0.3, 0.5, 0.7, 1.0] print(sigmoid(ten)) print(1 / (1 + exp(-ten))) for i in 0..<5 { print("###\(ten[i])") print(gradient(of: sigmoid)(ten[i])) print(gradient(of: { 1 / (1 + exp(-$0)) })(ten[i])) }
[ 0.5, 0.5744425, 0.6224593, 0.66818774, 0.7310586] [ 0.5, 0.5744425, 0.62245935, 0.66818774, 0.7310586] ###0.0 0.0 0.25 ###0.3 0.21000001 0.24445829 ###0.5 0.25 0.23500371 ###0.7 0.21000001 0.22171286 ###1.0 0.0 0.19661197