text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>using UniGetUI.PackageEngine.Managers.Generic.NuGet;
using UniGetUI.PackageEngine.Managers.Generic.NuGet.Internal;
using UniGetUI.PackageEngine.Managers.PowerShellManager;
using UniGetUI.PackageEngine.Tests.Infrastructure.Builders;
using UniGetUI.PackageEngine.Tests.Infrastructure.Helpers;
namespace UniG... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|> .WithVersion("1.0.0")
.Build(),
])
.Build();
var loader = new TestPackageLoader(
[manager],
loadPackages: testManager => testManager.GetInstalledPackages(),
isPackageValid: package => Task.FromResult(package.Id ... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>using UniGetUI.Core.Data;
using UniGetUI.Core.SettingsEngine;
using UniGetUI.Core.SettingsEngine.SecureSettings;
using UniGetUI.Core.Tools;
using UniGetUI.PackageEngine.PackageClasses;
using UniGetUI.PackageEngine.Tests.Infrastructure.Builders;
using UniGetUI.PackageEngine.Tests.Infrastructure.Fakes;
nam... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>using System.Diagnostics;
using System.Reflection;
using UniGetUI.Core.Logging;
using UniGetUI.Core.Tools;
using UniGetUI.Interface.Enums;
using UniGetUI.PackageEngine.Enums;
using UniGetUI.PackageEngine.Interfaces;
using UniGetUI.PackageEngine.Operations;
using UniGetUI.PackageEngine.PackageClasses;
usin... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>();
InitializeLoaders();
foreach (var v in installedVersions.Split(';', StringSplitOptions.RemoveEmptyEntries))
{
await InstalledPackagesLoader.Instance.AddForeign(
new PackageBuilder().WithManager(manager).WithId("Contoso.Tool").WithVersion(v.Trim()).B... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>toRetryMutationsForKnownPipFailures()
{
var manager = new Pip();
var breakSystemPackage = new PackageBuilder().WithManager(manager).WithId("requests").Build();
var userScopedPackage = new PackageBuilder().WithManager(manager).WithId("requests").Build();
var externallyM... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>#if WINDOWS
using UniGetUI.PackageEngine.Enums;
using UniGetUI.PackageEngine.Managers.PowerShell7Manager;
namespace UniGetUI.PackageEngine.Tests;
public sealed class PowerShell7ManagerTests
{
[Fact]
public void ParseInstalledPackages_BuildsPackagesFromTabDelimitedOutput()
{
var manag... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>#if WINDOWS
using UniGetUI.PackageEngine.Managers.PowerShellManager;
namespace UniGetUI.PackageEngine.Tests;
public sealed class PowerShellMa<|fim_suffix|>t.Equal("Pester", package.Id);
}
}
#endif
<|fim_middle|>nagerTests
{
[Fact]
public void ParseInstalledPackages_BuildsPackagesFromModuleTa... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>#if WINDOWS
using UniGetUI.Core.Data;
using UniGetUI.Core.SettingsEngine;
using UniGetUI.PackageEngine.Enums;
using UniGetUI.PackageEngine.Interfaces;
using UniGetUI.PackageEngine.Managers.ScoopManager;
using UniGetUI.PackageEngine.Serializable;
using UniGetUI.PackageEngine.Structs;
using UniGetUI.Package... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>using UniGetUI.Core.Data;
using UniGetUI.Core.SettingsEngine;
using UniGetUI.PackageEngine.Enums;
using UniGetUI.PackageEngine.Managers.SnapManager;
using UniGetUI.PackageEngine.PackageClasses;
using UniGetUI.PackageEngine.Serializable;
using UniGetUI.PackageEngine.Tests.Infrastructure.Assertions;
using U... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>rtInfo.StandardInputEncoding = System.Text.Encoding.UTF8;
process.StartInfo.WorkingDirectory = Environment.GetFolderPath(
Environment.SpecialFolder.UserProfile
);
process.StartInfo.FileName = "lol";
process.StartInfo.Arguments = "lol";
... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>on = true)]
<|fim_prefix|>using Xunit;
[assembl<|fim_middle|>y: CollectionBehavior(DisableTestParallelizati<|endoftext|> | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>ew InstalledPackagesLoader([manager]);
var discoverableLoader = new DiscoverablePackagesLoader([manager]);
var loader = new TestUpgradablePackagesLoader([manager]);
var availablePackage = new PackageBuilder().WithManager(manager).WithId("Contoso.Tagged").Build();
var instal... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>t; } = [];
public int? ReturnCode { get; private set; }
public IReadOnlyList<string> AsColoredString(bool verbose = false) => Lines;
public void Close(int returnCode) => ReturnCode = returnCode;
public void Error(Exception? e) => Lines.Add(e?.Message ?? "");
pub... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace UniGetUI.Tests;
public sealed class AutoUpdaterTests
{
[Theory]
[InlineData("https://devolutions.net/productinfo.json", false, true)]
[InlineData("https://updates.devolutions.net/productinfo.json", false, true)]
[Inli... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>using System.Text.Json;
using UniGetUI.Core.Data;
using UniGetUI.Core.SettingsEngine;
using UniGetUI.Core.SettingsEngine.SecureSettings;
namespace UniGetUI.Tests;
public sealed class CLIHandlerTests : IDisposable
{
private readonly string _testRoot = Path.Combine(
Path.GetTempPath(),
... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>liParseResult result = IpcCliSyntax.Parse(
["source", "add", "--manager", "dotnet-tool", "--source-name", "nuget.org", "--source-url", "https://api.nuget.org/v3/index.json"]
);
Assert.Equal(IpcCliParseStatus.Success, result.Status);
Assert.Equal("add-source", GetComman... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|> 7058,
"Headless.Pipe"
);
headlessOptions.Persist(
sessionId: "headless-session",
token: "headless-token",
sessionKind: IpcTransportOptions.HeadlessSessionKind,
processId: Environment.ProcessId
);
var options = Ip... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>[Fact]
public void ResolveModernExecutablePath_PrefersCurrentArchitectureDevelopmentBuildOutput()
{
string baseDirectory = Path.Combine(
_testRoot,
"UniGetUI",
"bin",
"x64",
"Debug",
"net10.0-windows10.0.26100.0",
... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>true)]
<|fim_prefix|>using Xunit;
<|fim_middle|>[assembly: CollectionBehavior(DisableTestParallelization = <|endoftext|> | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>using System.Runtime.InteropServices;
namespace WindowsPackageManager.Interop;
public sealed class WinGetComActivationException : COMException
{
public Guid Clsid { get; }
public Guid Iid { get; }
public bool AllowLowerTrustRegistration { get; }
public string HResultHex => $"0x{HResult:X... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>itInvokeTest = unchecked((int)0x8A15C105);
public const int WinGetConfigUnitInvokeSet = unchecked((int)0x8A15C106);
public const int WinGetConfigUnitModuleConflict = unchecked((int)0x8A15C107);
public const int WinGetConfigUnitImportModule = unchecked((int)0x8A15C108);
public const int Win... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace WindowsPackageManager.Interop;
internal sealed class ClassModel
{
/// <summary>
/// Gets the interface for the projected class type generated by CsWinRT
/// </summary>
public Type InterfaceType { get; in... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.Management.Deployment;
namespace WindowsPackageManager.Interop;
internal static class ClassesDefinition
{
private static Dictionary<Type, ClassModel> Classes { get; } =
new()
{
[ty... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>T License.
namespace WindowsPackageManager.Interop;
public enum ClsidContext
{
// Production CLSID Guids
Prod,
// Development CLSID Guids
Dev,
}
<|fim_prefix|>// Copyright (c) Microsoft<|fim_middle|> Corporation.
// Licensed under the MI<|endoftext|> | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace WindowsPackageManager.Interop;
/// <summary>
/// Factory for creating winget COM objects using manual activation
/// to have them in an elevated context.
/// </summary>
/// <remarks>
/// This needs to be called from an ... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>reateCompositePackageCatalogOptions() =>
CreateInstance<CreateCompositePackageCatalogOptions>();
public InstallOptions CreateInstallOptions() => CreateInstance<InstallOptions>();
public UninstallOptions CreateUninstallOptions() => CreateInstance<UninstallOptions>();
public PackageMa... | fim | Devolutions/UniGetUI | csharp |
<|fim_suffix|>tivatedInstance = Activator.CreateInstance(projectedType);
if (activatedInstance is null)
{
throw new WinGetComActivationException(
clsid,
iid,
unchecked((int)0x80004003),
_allowLowerTru... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>namespace DiffSharp
// This project is to bundle <|fim_suffix|>e and some default backends into a single project
// See DiffSharp.Core for main DiffSharp code<|fim_middle|>DiffSharp.Cor<|endoftext|> | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>namespace DiffSharp
// This project is to bundle DiffSharp.Core and some default backe<|fim_suffix|>o a single project
// See DiffSharp.Core for main DiffSharp code<|fim_middle|>nds int<|endoftext|> | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>ffSharp.Core and some default backends into a single project
// See DiffSharp.Core for main DiffSharp code<|fim_prefix|>namespace Dif<|fim_middle|>fSharp
// This project is to bundle Di<|endoftext|> | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>namespace <|fim_suffix|>undle DiffSharp.Core and some default backends into a single project
// See DiffSharp.Core for main DiffSharp code<|fim_middle|>DiffSharp
// This project is to b<|endoftext|> | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>namespace DiffSharp
// This project is to bundle Dif<|fim_suffix|>ends into a single project
// See DiffSharp.Core for main DiffSharp code<|fim_middle|>fSharp.Core and some default back<|endoftext|> | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// PyTorch styl<|fim_suffix|> style<|fim_middle|>e
// DiffSharp<|endoftext|> | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>") with
member _.fRaw(a) = a.SinT()
member _.dfda(a,f) = a.cos()
}
(a)
(**
$ f(a) = \mathrm{log}(a) $, with derivative $ \frac{\partial f(a)}{\partial a} = 1/a \;$.
*)
type Tensor with
member a.log() =
Tensor.Op
{ new UnaryO... | fim | DiffSharp/DiffSharp | fsharp |
(*** condition: prepare ***)
#I "../tests/DiffSharp.Tests/bin/Debug/net6.0"
#r "DiffSharp.Core.dll"
#r "DiffSharp.Data.dll"
#r "DiffSharp.Backends.Reference.dll"
#r "DiffSharp.Backends.Torch.dll"
// These are needed to make fsdocs --eval work. If we don't select a backend like this in the beginning, we get erratic beha... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>in macOS, and `torch.dll` in Windows.
open System.Runtime.InteropServices
NativeLibrary.Load("/home/user/anaconda3/lib/python3.8/site-packages/torch/lib/libtorch.so")
## Backends and Devices
DiffSharp currently provides two computation backends.
* The `Torch` backend is the default and recomm... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>(*** condition: prepare ***)
#I "../tests/DiffSharp.Tests/bin/Debug/net6.0"
#r "DiffSharp.Core.dll"
#r "DiffSharp.Data.dll"
#r "DiffSharp.Backends.Reference.dll"
#r "DiffSharp.Backends.Torch.dll"
// Thes<|fim_suffix|>or.
DiffSharp.dsharp.config(backend=DiffSharp.Backend.Reference)
DiffSharp.dsharp.seed(12... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>(*** condition: prepare ***)
#I "../tests/DiffSharp.Tests/bin/Debug/net6.0"
#r "DiffSharp.Core.dll"
#r "DiffSharp.Data.dll"
#r "DiffSharp.Backends.Reference.dll"
#r "DiffSharp.Backends.Torch.dll"
#r "nuget: SixLabors.ImageSharp,1.0.1"
// These are needed to make fsdocs --eval work. If we don't select a b... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>(*** condition: prepare ***)
#I "../tests/DiffSharp.Tests/bin/Debug/net6.0"
#r "DiffSharp.Core.dll"
#r "DiffSharp.Data.dll"
#r "DiffSharp.Backends.Reference.dll"
#r "DiffSharp.Backends.Torch.dll"
// These are needed to make fsdocs --eval work. If we don't select a backend like this in the beginning, we ge... | fim | DiffSharp/DiffSharp | fsharp |
#!/usr/bin/env -S dotnet fsi
#I "../tests/DiffSharp.Tests/bin/Debug/net6.0"
#r "DiffSharp.Core.dll"
#r "DiffSharp.Data.dll"
#r "DiffSharp.Backends.Torch.dll"
// Libtorch binaries
// Option A: you can use a platform-specific nuget package
#r "nuget: TorchSharp-cpu, 0.96.5"
// #r "nuget: TorchSharp-cuda-linux, 0.96.5"
... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|> y))
// Objective
// DiffProg<Tensor,Tensor> -> Tensor
let loss (diffprog:DiffProg<Tensor, Tensor>) = dsharp.mseLoss(diffprog.run x, y)
// Learned diferentiable program
// DiffProg<Tensor,Tensor>
let dpLearned = learn dp loss
// Function that runs the differentiable program with new data
// Tensor -> T... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>#!/usr/bin/env -S dotnet fsi
#I "../tests/DiffSharp.Tests/bin/Debug/net6.0"
#r "DiffSharp.Core.dll"
#r "DiffSharp.Data.dll"
#r "DiffSharp.Backends.Torch.dll"
// Libtorch binaries
// Option A: you can use a platform-specific nuget package
#r "nuget: TorchSharp-cpu, 0.96.5"
// #r "nuget: TorchSharp-cuda-l... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>#!/usr/bin/env -S dotnet fsi
#I "../tests/DiffSharp.Tests/bin/Debug/net6.0"
#r "DiffSharp.Core.dll"
#r "DiffSharp.Data.dll"
#r "DiffSharp.Backends.Torch.dll"
// Libtorch binaries
// Option A: you can use a platform-specific nuget package
#r "nuget: TorchSharp-cpu, 0.96.5"
// #r "nuget: TorchSharp-cuda-l... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>#!/usr/bin/env -S dotnet fsi
#I "../tests/DiffSharp.Tests/bin/Debug/net6.0"
#r "DiffSharp.Core.dll"
#r "DiffSharp.Data.dll"
#r "DiffSharp.Backends.Torch.dll"
// Libtorch binaries
// Option A: you can use a platform-specific nuget package
#r "nuget: TorchSharp-cpu, 0.96.5"
// #r "nuget: TorchSharp-cuda-l... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>ets.s3.amazonaws.com/mnist/t10k-images-idx3-ubyte.gz";
"https://ossci-datasets.s3.amazonaws.com/mnist/t10k-labels-idx1-ubyte.gz"]
let trainSet = MNIST("../data", urls=urls, train=true, transform=id)
let trainLoader = trainSet.loader(batchSize=batchSize, shuffle=true)
let validSet = MNIST("../... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>namespace DiffSharp
open DiffSharp
op<|fim_suffix|> /// code that converts to Torch tensors will not be differentiable using
/// DiffSharp differentiation capabilities.
/// </remarks>
member t.toTorch() =
match t.primalRaw with
| :? TorchRawTensor as trt -... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace rec DiffSharp.Backends.Torch
open System
open DiffSharp
open DiffSharp.Back... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|> try System.Reflection.Assembly.Load(fullName)
with e -> failwithf "Couldn't find assembly '%s', error = %s" fullName (e.ToString())
let typeName = sprintf "DiffSharp.Backends.%s.%s%s" backend.Name backend.Name typeof<'T>.Name
let theT... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace rec DiffSharp.Data
open DiffSharp
open DiffSharp.Compose
open DiffSharp.Uti... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>nts a device specification.
[<Struct>]
type Device =
| Device of DeviceType * int
member x.DeviceType = (let (Device(a,_)) = x in a)
member x.DeviceIndex = (let (Device(_,b)) = x in b)
static member CPU = Device(DeviceType.CPU, -1)
static member GPU = Device(DeviceType.CUDA, 0)
me... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>ummary>TBD</summary>
static member cov(?correction:int64, ?fweights:Tensor, ?aweights:Tensor) = fun (a:Tensor) -> a.cov(?correction=correction,?fweights=fweights,?aweights=aweights)
/// <summary>TBD</summary>
static member corrcoef() = fun (a:Tensor) -> a.corrcoef()
/// <summary>TBD</sum... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
module DiffSharp.Numerical
// Functional numerical differentiation API
type dsharp wi... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- Univer<|fim_suffix|>member vjp f x v = dsharp.jacobianTv f x v
/// <summary>TBD</summary>
static member j f x = dsharp.jacobian f x
/// <summary>TBD</summary>
static member fgvp f x v = dsharp.fgradv f x v
/// <summary>TBD</summary>
static member fg f ... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace rec DiffSharp.Distributions
open DiffSharp
open DiffSharp.Compose
open DiffS... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp
/// Represents a storage type for elements of a tensor
[<Struct>... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Util
open System
open System.Collections.Generic
open System.Col... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Model
open DiffSharp
/// <summary>Applies Batch Normalization over a 2D or 3D ... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Model
open DiffSharp
/// <summary>A model that applies a 1D conv... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Model
open DiffSharp
/// <summary>A model that applies a 1D transposed convol... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICE<|fim_suffix|>y zero out entire channels. Each channel will be zeroed out independently on every forward call with... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Model
open DiffSharp
/// <summary>A model that applies a linear transformation... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Model
open DiffSharp
module RecurrentShape =
let RNNCell (in... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Model
type Sequential(models: seq<Model>) =
inherit Model()
do base.ad... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Model
open DiffSharp
open DiffSharp.Util
/// <summary>Variational auto-encoder... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace rec DiffSharp.Model
open DiffSharp
open DiffSharp.Util
open System.Collections
open Syste... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp
[<AutoOpen>]
module OpAvgPoolExtensions =
type Tensor with
... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>anBMM a.shape b.shape |> ignore
Tensor.Op
{ new BinaryOp("bmm") with
member _.fRaw(a,b) = a.BMMTT(b)
member _.ad_dfda(a,ad,b,f) = ad.bmm(b)
member _.bd_dfdb(a,b,bd,f) = a.bmm(bd)
member _.fd_dfda(a... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp
[<AutoOpen>]
module OpDetExtensions =
type Tensor with
... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|> type dsharp with
static member inv(a:Tensor) = a.inv()
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
names... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxfo<|fim_suffix|>n root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp
[<AutoOpen>]
module OpNormExtensions =
type Tensor with
member a.norm(?order:float, ?dim:int, ?keepDim:bool) =
if n... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>m>
/// <param name="b">The second tensor.</param>
static member outer(a:Tensor, b:Tensor) = a.outer(b)
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Claus... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|> -ba.matmul(f.transpose(-2, -1))
member _.fd_dfdb(a,b,f,fd) = a.transpose(-2, -1).solve(fd)
}
(a,b)
type dsharp with
static member solve(a:Tensor, b:Tensor) = a.solve(b)
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim G... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace rec DiffSharp.Optim
open DiffSharp
open DiffSharp.Shorten
open DiffSharp.Mo... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp
type Printer =
| Default
| Short
| Full
| Custom ... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|> the tensor
abstract NegInPlace: unit -> unit
/// Modifies the tensor by the element-wise sign of the tensor
abstract SignInPlace: unit -> unit
/// Modifies the tensor by the element-wise integer floor of the tensor
abstract FloorInPlace: unit -> unit
/// Modifies the tensor by ... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>type: Dtype) (scalarDtype: Dtype) =
match tensorDtype.IsFloatingPoint, scalarDtype.IsFloatingPoint with
| false, false -> Dtype.Default
| false, true -> Dtype.Default
| true, false -> tensorDtype
| true, true -> tensorDtype
<|fim_prefix|>// Copyright (c) 2... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|> | Some _ , Some _ -> failwithf "Expecting only one of padding, paddings"
| Some p, None -> [|p; p|]
| None, Some p -> let p = p |> Array.ofSeq in if p.Length <> 2 then failwithf "Expecting paddings to be 2-dimensional" else p
| _ -> [|0; 0|]
let dila... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
/// Contains utilities related to the DiffSharp programming model.
namespace DiffSharp.Util
open Sy... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>//yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz"])
// Alternative URLs that work when LeCun's site is not responding
let urls = List.ofSeq <| defaultArg urls (Seq.ofList
["https://ossci-datasets.s3.amazonaws.com/mnist/train-images-idx3-ubyte.gz";
"https... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp
open SixLabors.ImageSharp
open SixLabors.ImageSharp.Processing
op... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>aultArg figSize (6.4, 4.8)
add(sprintf "plt.figure(figsize=(%A,%A))" (fst figSize) (snd figSize))
member _.legend() = add("plt.legend()")
member _.tightLayout() = add("plt.tight_layout()")
member _.xlabel(label) = add(sprintf "plt.xlabel('%s')" label)
member _.ylabel(label) = add(s... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>h() =
let n = perf.configure(Backend.Torch, 10)
for _ in 1 .. n do res <- dsharpTensor + dsharpTensor // TODO: no optimised routine in RawTensor as yet
[<Benchmark; BenchmarkCategory("addInPlace")>]
member perf.addInPlace_RawTensor_Reference() =
let n = perf.configure(B... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Benchmarks
open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Configs
open B... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BS<|fim_suffix|>ion.Assembly.GetExecutingAssembly()).Run(args)
0
<|fim_middle|>D 2-Clause License. See LICENSE in root of repository.
open... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace DiffSharp.Benchmarks.Python
open BenchmarkDotNet.Attributes
open Benchmark... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>one
else
None
with _ -> None
match v with
| None -> ()
| Some r -> yield r
]
File.WriteAllLines(Path.Combine(__SOURCE_DIRECTORY__, "results.csv"), lines)
0
<|fim_prefix|>// Copyright (c) 2016- University ... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>/ BSD 2-Clause License. See LICENSE in root of repository.
module Program = let [<EntryPoint>] main _ = 0<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.<|fim_middle|>ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
/<|endoftext|... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>type)
member _.linspace(startVal:float, endVal:float, steps:int, ?device, ?backend, ?dtype) =
dsharp.linspace(startVal, endVal, steps, ?device=dflt device defaultDevice, ?backend=dflt backend defaultBackend, ?dtype=dflt dtype defaultDtype)
member _.linspace(startVal:int, endVal:int, step... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace Tests
open DiffSharp
module Dtypes =
// We run most tests at all the... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>ow_tree"; "wolf"; "woman"; "worm"|]
Assert.AreEqual(classesCorrect, classes)
Assert.AreEqual(classNamesCorrect, classNames)
[<Test>]
member _.TestTensorDataset () =
let n, din, dout = 128, 64, 16
let x = dsharp.randn([n; din])
let y = dsharp.randn([n; dout... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace Tests
open NUnit.Framework
open DiffSharp
open DiffSharp.Util
#nowarn "00... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace Tests
open NUnit.Framework
open DiffSharp
open DiffSharp.Util
// #nowarn "... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace Tests
open NUnit.Framework
open DiffSharp
open DiffSharp.Compose
open DiffS... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>kEqual(distResampledWeightedCorrect, distResampledWeighted)
let distResampledMinMax = dist.resample(numEmpiricalSamples, minIndex=1, maxIndex=3)
let distResampledMinMaxMean = distResampledMinMax.mean
let distResampledMinMaxStddev = distResampledMinMax.stddev
... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_suffix|>et revz2 = op1 revx2 revy2
revz1.reverse(zd)
revz2.reverse(zd)
let revxd1 = revx1.derivative
let revxd2 = revx2.derivative
let revyd1 = revy1.isNoDiff
let revyd2 = revy2.isNoDiff
Assert.True(fwdz1.allclose(fwdz2, 0.01))
... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace Tests
open NUnit.Framework
open DiffSharp
open DiffSharp.Model
open DiffSha... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace Tests
open NUnit.Framework
open DiffSharp
open DiffSharp.Compose
open DiffS... | fim | DiffSharp/DiffSharp | fsharp |
// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace Tests
open NUnit.Framework
open DiffSharp
open DiffSharp.Compose
open DiffSharp.Model
ope... | fim | DiffSharp/DiffSharp | fsharp |
<|fim_prefix|>// Copyright (c) 2016- University of Oxford (Atilim Gunes Baydin <gunes@robots.ox.ac.uk>)
// and other contributors, see LICENSE in root of repository.
//
// BSD 2-Clause License. See LICENSE in root of repository.
namespace Tests
open NUnit.Framework
open DiffSharp
open DiffSharp.Compose
open DiffS... | fim | DiffSharp/DiffSharp | fsharp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.