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
""" | |
Simple example of manually performing "automatic" differentiation | |
""" | |
import numpy as np | |
from numpy import exp, sin, cos | |
def f(x, with_grad=False): | |
# Need to cache intermediates from forward pass (might not use all of them). | |
a = exp(x) |
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
using System.Runtime.CompilerServices; | |
using static ParsingExtensions; | |
string input = "Name: Andrew; Age: 31"; | |
string? name = null; | |
int age = 0; | |
if (input.TryParse($"Name: {Placeholder(ref name)}; Age: {Placeholder(ref age)}")) | |
{ |