This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = torch.randn([20, 1], requires_grad=True) | |
y = 3*x - 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(w.grad, b.grad) | |
#tensor([-50.2192]) tensor([90.6552]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conv.ask(new Suggestions('Alert me of new tips')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conv.ask(new Suggestions('Notify me')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | |
} |