Skip to content

Instantly share code, notes, and snippets.

Avatar

Don Syme dsyme

View GitHub Profile
View gist:93d07b2cecde3d7470c1a8628a06669b
[<ShapeCheck>]
type NeuralStyles(C: Int, H: Int, W: Int) =
    inherit Model()

    let instance_norm (channels: Int, h, w) = 
        model { 
            let! shift = Weight.uniform (Shape [| channels; h; w |], 0.0)
            and! scale = Weight.uniform (Shape [| channels; h; w |], 1.0)
            return (fun input  ->
View gist:81a5f51ecc18261b226abad83e6a0ed7
open System
type T() =
member this.Item
with get ([<ParamArray>] indices: int[]) = "_"
and set ([<ParamArray>] indices: int[]) (value: string) = ()
let t = T()
// Works correctly
printfn "%A" t.[2, 1, 0]
View rant.md
View gist:1b28a65cddf82aae10ac87eacf73943a
class='parameter'>recordType</span></dt><dd><p>The type of record to construct.</p></dd><dt><span class='parameter'>bindingFlags</span></dt><dd><p>Optional binding flags.</p></dd></dl><p class='returns'><p>Returns: A function to construct records of the given type.</p><table class='inner-list exception-list'><tr><td><a href=\"https://docs.microsoft.com/dotnet/api/system.argumentexception\">ArgumentException</a></td><td>Thrown when the input type is not a record type.</td></tr></table>"
},
{
"uri": "https://fsharp.github.io/fsharp-core-api-docs/reference/fsharp-reflection-fsharpvalue.html#PreComputeRecordConstructorInfo",
"title": "FSharpValue.PreComputeRecordConstructorInfo",
"content": "FSharpValue.PreComputeRecordConstructorInfo \nPreComputeRecordConstructorInfo \n<p class='summary'>Get a ConstructorInfo for a record type</p><dl><dt><span class='parameter'>recordType</span></dt><dd><p>The record type.</p></dd><dt><span class='parameter'>bindingFlags</span></dt><dd><p>Optional
View gist:dc86bf86de81b83b75557d4944db43c2
Topics
1. tokenization
2. parsing
3. checking and elaboration (i.e. producing TypedTree)
- $" " plain
- $"..." as FormattableString
View gist:b487c1aeccb7dab7ffa2e9fe7932f4eb

Fyro

Fyro Models

An Fyro model is an F# definition of the form:

[<ReflectedDefinition>]
let model (param1, .... paramN) = <distribution-expression>
View gist:dc915304b432be45d4b5e23d9a64cecf
This file has been truncated, but you can view the full file.
TryDownloadDotnetFrameworkSdk -- Test-IsAdmin = 'True'
pre-dl snPathX86Exists : True - 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe'
set WindowsSDK_ExecutablePath_x86=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools
set WindowsSDK_ExecutablePath_x64=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64
VisualFSharp.sln:
Build started 23/07/2020 16:13:52.
1>Project "C:\Users\dsyme\.nuget\packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.20364.3\tools\Build.proj" on node 1 (default targets).
1>Project "C:\Users\dsyme\.nuget\packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.20364.3\tools\Build.proj" (1) is building "C:\Users\dsyme\.nuget\packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.20364.3\tools\Tools.proj" (2) on node 1 (Restore target(s)).
2>_GetAllRestoreProjectPathItems:
View gist:19ffe7f268b39c34b927f2f06e936270
KernelBase.dll!00007ffc3943a308() Unknown
vcruntime140d.dll!00007ffbd2fdb1f0() Unknown
torch_cpu.dll!defaultErrorHandlerFunction(const char * msg, void * data) Line 27 C++
torch_cpu.dll!_THError(const char * file, const int line, const char * fmt, ...) Line 54 C++
[External Code]
torch_cpu.dll!c10::KernelFunction::callUnboxed<at::Tensor,at::Tensor const &,at::Tensor const &>(const c10::OperatorHandle & opHandle, const at::Tensor & <args_0>, const at::Tensor & <args_1>) Line 66 C++
torch_cpu.dll!c10::Dispatcher::callUnboxedWithDispatchKey<at::Tensor,at::Tensor const &,at::Tensor const &>(const c10::OperatorHandle & op, c10::DispatchKey dispatchKey, const at::Tensor & <args_0>, const at::Tensor & <args_1>) Line 221 C++
torch_cpu.dll!c10::Dispatcher::callUnboxed<at::Tensor,at::Tensor const &,at::Tensor const &>(const c10::OperatorHandle & op, const at::Tensor & <args_0>, const at::Tensor & <args_1>) Line 229 C++
torch_cpu.dll!c10::OperatorHandle::callUnboxed<at::Tensor,at::Tensor const &,at::T
View gist:9606cd38002295eb7ff1f28c3155df80
namespace FSharpBug9201
module CreateLockup =
//let inline castInternal< ^a, ^b when (^a or ^b) : (static member createFrom : ^a -> ^b)> (v: ^a): ^b =
// ((^a or ^b) : (static member createFrom : ^a -> ^b) v)
//let inline cast x: TestItemSeq =
// castInternal x
You can’t perform that action at this time.