Skip to content

Instantly share code, notes, and snippets.

View vaibhavkumar049's full-sized avatar
🐍
Python

Vaibhav Kumar Chaudhary vaibhavkumar049

🐍
Python
View GitHub Profile
x = torch.ones([3, 2], requires_grad=True)
y = x + 5
r = 1/(1 + torch.exp(-y))
a = torch.ones([3, 2])
r.backward(a)
print(x.grad)
x = torch.ones([3, 2], requires_grad=True)
y = x + 5
r = 1/(1 + torch.exp(-y))
a = torch.ones([3, 2])
r.backward(a)
print(x.grad)
x = torch.ones([3, 2], requires_grad=True)
y = x + 5
r = 1/(1 + torch.exp(-y))
a = torch.ones([3, 2])
r.backward(a)
print(x.grad)
x = torch.randn([20, 1], requires_grad=True)
y = 3*x - 2
w = torch.tensor([1.], requires_grad=True)
b = torch.tensor([1.], requires_grad=True)
y_hat = w*x + b
loss = torch.sum((y_hat - y)**2)
print(loss)
print(w.grad, b.grad)
#tensor([-50.2192]) tensor([90.6552])
learning_rate = 0.01
w = torch.tensor([1.], requires_grad=True)
b = torch.tensor([1.], requires_grad=True)
print(w.item(), b.item())
for i in range(10):
x = torch.randn([20, 1])
conv.ask(new Suggestions('Alert me of new tips'));
conv.ask(new Suggestions('Notify me'));
const {UpdatePermission}=require('actions-on-google');
app.intent(`setup_push`,(conv)=>{
// conv.user.storage={}
if(conv.user.storage['push_notification_asked'] === true)
{
conv.ask("You are already subscribed to notifications");
conv.ask(" Will you like to do something else")
conv.ask(new Suggestions('Do something else'));
}