MacroTools provides a library of tools for working with Julia code and expressions.

Overview

MacroTools.jl

Build Status

MacroTools provides a library of tools for working with Julia code and expressions. This includes a powerful template-matching system and code-walking tools that let you do deep transformations of code in a few lines. See the docs for more info.

Suggestions, issues and pull requsts are welcome.

Installation

]add MacroTools
Comments
  • Fixes 165, Fixes 177.

    Fixes 165, Fixes 177.

    A partial rewrite of splitarg and combinearg to fix https://github.com/FluxML/MacroTools.jl/issues/165 and https://github.com/FluxML/MacroTools.jl/issues/177.

    The big change here is that arg_type can be nothing if no type is declared for an argument. I know that this is a change to the interface, but I also see no other way to fix the problem. While we are changing the interface, we may want to consider handling literal nothing as an argument default through the base Some and something interface. (discussed in https://github.com/FluxML/MacroTools.jl/issues/35).

    opened by willow-ahrens 23
  • Option to deterministically generate unique ids instead of randomized animal names

    Option to deterministically generate unique ids instead of randomized animal names

    There are a couple of problems with the current animal name scheme used in alias_gensyms:

    1. There are only about 220 animal names in animals.txt. If you have more than 220 gensyms the following line in the current alias_gensyms function is going to error out:

    [email protected]!(syms, x, pop!(left))

    (left is a copy of the animals symbol list)

    1. Currently, the animal names list is randomized when the package is initialized. While working on ONNX.jl we were finding that given the same inputs we would get different code generated due to this randomization. This makes it very difficult for us to debug as we made changes to ONNX.jl and wanted to compare code generated from a prior version on the same inputs.

    This patch generates a simple unique id in the form of "sym_id_$counter" where the counter value is incremented on each gensym encountered.

    I would have preferred replacing all of the "#" characters in the gensym with blanks, however that did not work for me even though I tried the same scheme in the REPL on a gensym string and it did work (see the comment I added in alias_gensyms - maybe someone could get that working?)

    opened by philtomson 13
  • Support function return types in longdef/shortdef

    Support function return types in longdef/shortdef

    I also have a function that uses MacroTools to parse any function definition and return (name, arg, kwargs, body, return_type). Would that be accepted?

    opened by cstjean 13
  • more faithfully reconstruct original function in combinedef

    more faithfully reconstruct original function in combinedef

    Previously combinedef would put an ::Any return type annotation on any function it reconstructed that didn't have one originally, and also wrap the function body in one extra begin block. These both seem completely superfluous except amazingly when combined they trigger the bug I reported here: https://github.com/JuliaLang/julia/issues/29326.

    This PR gets rid of those things and more faithfully reconstructs the original function.

    I also switched to returning the expression via @q which would allow whatever macro is calling combinedef to insert the desired line numbers in there.

    opened by marius311 9
  • move shuffling of animals to be done on demand instead of during initialization

    move shuffling of animals to be done on demand instead of during initialization

    This package is heavily used throughout the ecosystem so optimizing its load time is quite important. The compilation time of the shuffle! call in the __init__ function adds quite a bit of overhead, so I moved this to be done the first time the variable is actually used instead.

    Without this PR:

    julia> @time using MacroTools
      0.067275 seconds (142.56 k allocations: 9.640 MiB, 61.33% compilation time)
    

    With this PR:

    julia> @time using MacroTools
      0.024947 seconds (28.79 k allocations: 3.159 MiB, 22.04% compilation time)
    

    It also removed quite a bit of "noise" when profiling other packages load time that happens to depend on this pacakge recursively.

    opened by KristofferC 8
  • code quality improvements from JET analysis

    code quality improvements from JET analysis

    I ran JET analysis on this package, and fixed some true positive errors.

    run JET on MacroTools

    julia> using JET
    julia> report_file("src/MacroTools.jl"; analyze_from_definitions = true, annotate_types = true)
    

    Before this PR

    ═════ 11 possible errors found ═════
    ┌ @ src/match/match.jl:27 Base.getproperty(Base.getproperty(MacroTools.Base, :match::Symbol)::typeof(match)(r"^@?(.*?)_+(_str)?$", MacroTools.string(s::Symbol)::String)::Union{Nothing, RegexMatch}, :captures::Symbol)
    │┌ @ Base.jl:33 Base.getfield(x::Nothing, f::Symbol)
    ││ type Nothing has no field captures
    │└──────────────
    ┌ @ src/match/types.jl:20 MacroTools.map(MacroTools.totype, ts::Vector{Symbol})
    │┌ @ abstractarray.jl:2301 Base.collect_similar(A::Vector{Symbol}, Base.Generator(f::typeof(MacroTools.totype), A::Vector{Symbol})::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})
    ││┌ @ array.jl:620 Base._collect(cont::Vector{Symbol}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, Base.IteratorEltype(itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})::Base.EltypeUnknown, Base.IteratorSize(itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})::Base.HasShape{1})
    │││┌ @ array.jl:710 Base.collect_to_with_first!(Base._similar_for(c::Vector{Symbol}, Base.typeof(v1::Union{Expr, Symbol})::Union{Type{Expr}, Type{Symbol}}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, isz::Base.HasShape{1})::Union{Vector{Expr}, Vector{Symbol}}, v1::Union{Expr, Symbol}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, st::Int64)
    ││││┌ @ array.jl:715 Base.setindex!(dest::Vector{Symbol}, v1::Expr, i1::Int64)
    │││││┌ @ array.jl:853 Base.convert(_::Type{Symbol}, x::Expr)
    ││││││ no matching method found for call signature: Base.convert(_::Type{Symbol}, x::Expr)
    │││││└────────────────
    ││││┌ @ array.jl:715 Base.setindex!(dest::Vector{Expr}, v1::Symbol, i1::Int64)
    │││││┌ @ array.jl:853 Base.convert(_::Type{Expr}, x::Symbol)
    ││││││ no matching method found for call signature: Base.convert(_::Type{Expr}, x::Symbol)
    │││││└────────────────
    ┌ @ src/utils.jl:21 Base.collect(Base.Generator(#11::MacroTools.var"#11#12", MacroTools.map(MacroTools.esc, xs::Tuple)::Any)::Base.Generator{_A, MacroTools.var"#11#12"} where _A)
    │┌ @ array.jl:697 Base.collect_to_with_first!(Base._array_for(Base.typeof(v1::Expr)::Type{Expr}, Base.getproperty(itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, :iter::Symbol)::Any, isz::Any)::Any, v1::Expr, itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, st::Any)
    ││┌ @ array.jl:721 Base.grow_to!(dest::Any, itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, st::Any)
    │││┌ @ dict.jl:153 Base.indexed_iterate(Core.getfield(Base.indexed_iterate(y::Tuple{Expr, Any}, 1)::Tuple{Expr, Int64}, 1)::Expr, 1)
    ││││┌ @ tuple.jl:89 Base.iterate(I::Expr)
    │││││ no matching method found for call signature: Base.iterate(I::Expr)
    ││││└───────────────
    ┌ @ src/utils.jl:423 MacroTools.rebuilddef(MacroTools.striplines(dict::Dict)::Dict)
    │ variable MacroTools.rebuilddef is not defined: MacroTools.rebuilddef(MacroTools.striplines(dict::Dict)::Dict)
    └────────────────────
    ┌ @ src/utils.jl:455 Core.tuple(splitvar::MacroTools.var"#splitvar#35"(arg::Any)::Union{Nothing, Tuple{Any, Any}}, Core.tuple(is_splat::Bool, default::Any)::Tuple{Bool, Any}...)
    │ no matching method found for call signature: Core.tuple(splitvar::MacroTools.var"#splitvar#35"(arg::Any)::Union{Nothing, Tuple{Any, Any}}, Core.tuple(is_splat::Bool, default::Any)::Tuple{Bool, Any}...)
    └────────────────────
    ┌ @ src/utils.jl:457 Core.tuple(splitvar::MacroTools.var"#splitvar#35"(arg_expr2::Any)::Union{Nothing, Tuple{Any, Any}}, Core.tuple(is_splat::Bool, MacroTools.nothing)::Tuple{Bool, Nothing}...)
    │ no matching method found for call signature: Core.tuple(splitvar::MacroTools.var"#splitvar#35"(arg_expr2::Any)::Union{Nothing, Tuple{Any, Any}}, Core.tuple(is_splat::Bool, MacroTools.nothing)::Tuple{Bool, Nothing}...)
    └────────────────────
    ┌ @ src/structdef.jl:13 MacroTools.parse_error(ex::Any)
    │ variable MacroTools.parse_error is not defined: MacroTools.parse_error(ex::Any)
    └───────────────────────
    ┌ @ src/structdef.jl:21 MacroTools.parse_error(ex::Any)
    │ variable MacroTools.parse_error is not defined: MacroTools.parse_error(ex::Any)
    └───────────────────────
    ┌ @ src/structdef.jl:29 MacroTools.parse_error(ex::Any)
    │ variable MacroTools.parse_error is not defined: MacroTools.parse_error(ex::Any)
    └───────────────────────
    ┌ @ src/examples/destruct.jl:24 MacroTools.error("Can't destructure fields with default values")
    │┌ @ error.jl:33 error(::String)
    ││ may throw: Base.throw($(Expr(:invoke, MethodInstance for ErrorException(::String), :(Base.ErrorException), Core.Argument(2)))::ErrorException)
    │└───────────────
    

    After this PR: only the false positives ramain (Julia's inference or JET itself should be improved)

    ═════ 4 possible errors found ═════
    ┌ @ src/match/types.jl:20 MacroTools.map(MacroTools.totype, ts::Vector{Symbol})
    │┌ @ abstractarray.jl:2301 Base.collect_similar(A::Vector{Symbol}, Base.Generator(f::typeof(MacroTools.totype), A::Vector{Symbol})::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})
    ││┌ @ array.jl:620 Base._collect(cont::Vector{Symbol}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, Base.IteratorEltype(itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})::Base.EltypeUnknown, Base.IteratorSize(itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)})::Base.HasShape{1})
    │││┌ @ array.jl:710 Base.collect_to_with_first!(Base._similar_for(c::Vector{Symbol}, Base.typeof(v1::Union{Expr, Symbol})::Union{Type{Expr}, Type{Symbol}}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, isz::Base.HasShape{1})::Union{Vector{Expr}, Vector{Symbol}}, v1::Union{Expr, Symbol}, itr::Base.Generator{Vector{Symbol}, typeof(MacroTools.totype)}, st::Int64)
    ││││┌ @ array.jl:715 Base.setindex!(dest::Vector{Symbol}, v1::Expr, i1::Int64)
    │││││┌ @ array.jl:853 Base.convert(_::Type{Symbol}, x::Expr)
    ││││││ no matching method found for call signature: Base.convert(_::Type{Symbol}, x::Expr)
    │││││└────────────────
    ││││┌ @ array.jl:715 Base.setindex!(dest::Vector{Expr}, v1::Symbol, i1::Int64)
    │││││┌ @ array.jl:853 Base.convert(_::Type{Expr}, x::Symbol)
    ││││││ no matching method found for call signature: Base.convert(_::Type{Expr}, x::Symbol)
    │││││└────────────────
    ┌ @ src/utils.jl:21 Base.collect(Base.Generator(#11::MacroTools.var"#11#12", MacroTools.map(MacroTools.esc, xs::Tuple)::Any)::Base.Generator{_A, MacroTools.var"#11#12"} where _A)
    │┌ @ array.jl:697 Base.collect_to_with_first!(Base._array_for(Base.typeof(v1::Expr)::Type{Expr}, Base.getproperty(itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, :iter::Symbol)::Any, isz::Any)::Any, v1::Expr, itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, st::Any)
    ││┌ @ array.jl:721 Base.grow_to!(dest::Any, itr::Base.Generator{_A, MacroTools.var"#11#12"} where _A, st::Any)
    │││┌ @ dict.jl:153 Base.indexed_iterate(Core.getfield(Base.indexed_iterate(y::Tuple{Expr, Any}, 1)::Tuple{Expr, Int64}, 1)::Expr, 1)
    ││││┌ @ tuple.jl:89 Base.iterate(I::Expr)
    │││││ no matching method found for call signature: Base.iterate(I::Expr)
    ││││└───────────────
    ┌ @ src/examples/destruct.jl:24 MacroTools.error("Can't destructure fields with default values")
    │┌ @ error.jl:33 error(::String)
    ││ may throw: Base.throw($(Expr(:invoke, MethodInstance for ErrorException(::String), :(Base.ErrorException), Core.Argument(2)))::ErrorException)
    │└───────────────
    
    opened by aviatesk 8
  • improve code quality and type instabilities

    improve code quality and type instabilities

    I used JET and fixed some actual errors and type instabilities. (this PR is the final output of my demo at our workshop)

    /cc @pfitzseb Could you review this PR, please ? :)

    opened by aviatesk 7
  • splitarg incompatible with kwargs on 1.7

    splitarg incompatible with kwargs on 1.7

    Therefore, it is no longer safe to do funcdef[:kwargs] = map(arg->combinearg(splitarg(arg)...), funcdef[:kwargs], since this would transform a definition like f(;kwargs...) to f(;kwargs::Any...) which is no longer allowed in Julia 1.7. I don't know why that's no longer allowed, but from the REPL:

    ERROR: syntax: "x::Any" is not a valid function argument name around REPL[3]:1
    Stacktrace:
     [1] top-level scope
       @ REPL[3]:1
    
    opened by willow-ahrens 6
  • make

    make "slurp" pattern configurable

    This PR setups IGNORED_SLURP_PATTERNS::Set{Symbol}, which allows users to configure patterns that should not be recognized as "slurp"s.

    The motivation here is that there can be double-scores in variable names and so we sometimes may want them not to be recognized as "slurp" pattern.

    For example, let's consider when we want to specify a pattern that only matches __init__() expression:

    julia> @capture(:(__init__()), __init__()), @capture(:(foo()), __init__()) # you may want the latter case not to match
    (true, true)
    

    With this PR, we can configure IGNORED_SLURP_PATTERNS and achieve what we want:

    julia> push!(MacroTools.IGNORED_SLURP_PATTERNS, :__init__); # configure `IGNORED_SLURP_PATTERNS`
    
    julia> @capture(:(__init__()), __init__()), @capture(:(foo()), __init__()) # now `__init__` isn't recognized as slurp pattern
    (true, false)
    

    IGNORED_SLURP_PATTERNS is initialized as an empty set, and thus this change doesn't break any existing behavior by default.

    opened by aviatesk 6
  • don't use exceptions to implement `ismatch` and `trymatch`

    don't use exceptions to implement `ismatch` and `trymatch`

    This is causing https://github.com/JuliaLang/julia/issues/28221. At least for APIs that return a result instead of exposing MatchError, the package should use return values instead of exceptions.

    opened by JeffBezanson 5
  • bizzare match failure for macros in type assertions

    bizzare match failure for macros in type assertions

    MacroTools can't match macros when they appear in the type assertions in function calls. This seems like a crazy issue, but a key macro in my package depended on this functionality and now something has changed with the latest julia build and things fail. Any ideas as to why this match failure would happen?

                   _
       _       _ _(_)_     |  A fresh approach to technical computing
      (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
       _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
      | | | | | | |/ _` |  |
      | | |_| | | | (_| |  |  Version 0.7.0-DEV.5246 (2018-05-29 13:27 UTC)
     _/ |\__'_|_|_|\__'_|  |  Commit 082be9a (8 days old master)
    |__/                   |  x86_64-apple-darwin17.5.0
    
    (v0.7) pkg> up MacroTools
      Updating registry at `~/.julia/registries/Uncurated`
      Updating git-repo `https://github.com/JuliaRegistries/Uncurated.git`
     Resolving package versions...
      Updating `~/.julia/environments/v0.7/Project.toml`
     [no changes]
      Updating `~/.julia/environments/v0.7/Manifest.toml`
     [no changes]
    
    julia> using MacroTools
    
    julia> x = :(foo(x::@bar(qux))).args[2].args[2]
    :(#= REPL[3]:1 =# @bar qux)
    
    julia> :(@bar(qux))
    :(#= REPL[4]:1 =# @bar qux)
    
    julia> x.head
    :macrocall
    
    julia> :(@bar(qux)).head
    :macrocall
    
    julia> x.args
    3-element Array{Any,1}:
     Symbol("@bar")
     :(#= REPL[3]:1 =#)
     :qux
    
    julia> :(@bar(qux)).args
    3-element Array{Any,1}:
     Symbol("@bar")
     :(#= REPL[8]:1 =#)
     :qux
    
    julia> @capture(x, @bar(qux))
    false
    
    julia> @capture(:(@bar(qux)), @bar(qux))
    true
    

    EDIT: It appears that this has something to do with line number nodes getting passed as arguments to macros. I rolled a custom solution for myself, but I'll dig into this sometime when I have more time. I don't think this has anything to do with the type assertions at all now.

    opened by willow-ahrens 5
  • Splitdef errors on anonymous function with a single varargs argument

    Splitdef errors on anonymous function with a single varargs argument

    splitdef fails with an assertion on an anonymous function with a single varargs argument:

    julia> splitdef(Meta.parse(" (args...) -> 0 "))
    ERROR: ArgumentError: Not a function definition: :(args...->begin
              #= none:1 =#
              0
          end)
    Stacktrace:
     [1] splitdef(fdef::Expr)
       @ MacroTools ~/.julia/packages/MacroTools/PP9IQ/src/utils.jl:317
    

    Either adding another argument or using the long form of the definition is fine:

    julia> splitdef(Meta.parse(" (x, args...) -> 0 "))
    Dict{Symbol, Any} with 4 entries:
      :args        => Any[:x, :(args...)]
      :body        => quote…
      :kwargs      => Any[]
      :whereparams => ()
    
    julia> splitdef(Meta.parse(" function f(args...) 0 end "))
    Dict{Symbol, Any} with 5 entries:
      :name        => :f
      :args        => Any[:(args...)]
      :kwargs      => Any[]
      :body        => quote…
      :whereparams => ()
    
    opened by julbinb 1
  • @capture union problem

    @capture union problem

    Similar to what was noted in https://github.com/FluxML/MacroTools.jl/issues/40#issuecomment-357466077,

    julia> @capture :(myvariable = 2) (lhs_Symbol = rhs_)
    true
    
    julia> @capture :(myvariable = 2) (lhs_Symbol = rhs_) | someotherpat
    false
    
    julia> @capture :(myvariable = 2) (lhs_ = rhs_) | someotherpat
    true
    

    The second match should be true as well.

    opened by cstjean 0
  • add dict interface splitargdef and combineargdef

    add dict interface splitargdef and combineargdef

    This PR adds new methods splitargdef and combineargdef (in addition to existing splitarg and combinearg) that use dictionaries as an interface. The dict interface more completely expresses corner cases, as described in https://github.com/FluxML/MacroTools.jl/pull/178. In particular, it provides robust solutions for literal nothing argument defaults and avoids typeasserts when no type is given for an argument.

    opened by willow-ahrens 5
  • `isdef()` seems to return true in any case

    `isdef()` seems to return true in any case

    help?> MacroTools.isdef
      Test for function definition expressions.
    
    julia> MacroTools.isdef(:(f() = 3))
    true
    
    julia> MacroTools.isdef(:(f()))
    true
    
    julia> MacroTools.isdef(:ix)
    true
    
    
    opened by omlins 2
  • rmlines would be more useful if it worked recursively

    rmlines would be more useful if it worked recursively

    rmlines would be more useful it it worked recursively.

    rmlines(Meta.parse("""
    begin
       begin
          begin
    end
    end
    end"""))
    quote
        begin
            #= none:3 =#
            begin
                #= none:4 =#
            end
        end
    end
    

    Yes, one could use postwalk, but I don't think one should have to.

    Also, why isn't postwalk exported?

    At the very least, the documentation should manage expectations by saying that it doesn'[t work recursively and suggesting the use of postwalk.

    opened by MarkNahabedian 1
Releases(v0.5.10)
Owner
FluxML
The Elegant Machine Learning Stack
FluxML
This repository contains implementations and illustrative code to accompany DeepMind publications

DeepMind Research This repository contains implementations and illustrative code to accompany DeepMind publications. Along with publishing papers to a

DeepMind 11.3k Dec 31, 2022
External Attention Network

Beyond Self-attention: External Attention using Two Linear Layers for Visual Tasks paper : https://arxiv.org/abs/2105.02358 EAMLP will come soon Jitto

MenghaoGuo 357 Dec 11, 2022
PyTorch version implementation of DORN

DORN_PyTorch This is a PyTorch version implementation of DORN Reference H. Fu, M. Gong, C. Wang, K. Batmanghelich and D. Tao: Deep Ordinal Regression

Zilin.Zhang 3 Apr 27, 2022
CodeContests is a competitive programming dataset for machine-learning

CodeContests CodeContests is a competitive programming dataset for machine-learning. This dataset was used when training AlphaCode. It consists of pro

DeepMind 1.6k Jan 08, 2023
Code for CVPR 2021 paper TransNAS-Bench-101: Improving Transferrability and Generalizability of Cross-Task Neural Architecture Search.

TransNAS-Bench-101 This repository contains the publishable code for CVPR 2021 paper TransNAS-Bench-101: Improving Transferrability and Generalizabili

Yawen Duan 17 Nov 20, 2022
Repository of our paper 'Refer-it-in-RGBD' in CVPR 2021

Refer-it-in-RGBD This is the repository of our paper 'Refer-it-in-RGBD: A Bottom-up Approach for 3D Visual Grounding in RGBD Images' in CVPR 2021 Pape

Haolin Liu 34 Nov 07, 2022
A PyTorch re-implementation of Neural Radiance Fields

nerf-pytorch A PyTorch re-implementation Project | Video | Paper NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis Ben Mildenhall

Krishna Murthy 709 Jan 09, 2023
Riemann Noise Injection With PyTorch

Riemann Noise Injection - PyTorch A module for modeling GAN noise injection based on Riemann geometry, as described in Ruili Feng, Deli Zhao, and Zhen

2 May 27, 2022
Segmentation-Aware Convolutional Networks Using Local Attention Masks

Segmentation-Aware Convolutional Networks Using Local Attention Masks [Project Page] [Paper] Segmentation-aware convolution filters are invariant to b

144 Jun 29, 2022
SAS output to EXCEL converter for Cornell/MIT Language and acquisition lab

CORNELLSASLAB SAS output to EXCEL converter for Cornell/MIT Language and acquisition lab Instructions: This python code can be used to convert SAS out

2 Jan 26, 2022
The implementation for "Comprehensive Knowledge Distillation with Causal Intervention".

Comprehensive Knowledge Distillation with Causal Intervention This repository is a PyTorch implementation of "Comprehensive Knowledge Distillation wit

Xiang Deng 10 Nov 03, 2022
Optimal space decomposition based-product quantization for approximate nearest neighbor search

Optimal space decomposition based-product quantization for approximate nearest neighbor search Abstract Product quantization(PQ) is an effective neare

Mylove 1 Nov 19, 2021
A learning-based data collection tool for human segmentation

FullBodyFilter A Learning-Based Data Collection Tool For Human Segmentation Contents Documentation Source Code and Scripts Overview of Project Usage O

Robert Jiang 4 Jun 24, 2022
LSTM model trained on a small dataset of 3000 names written in PyTorch

LSTM model trained on a small dataset of 3000 names. Model generates names from model by selecting one out of top 3 letters suggested by model at a time until an EOS (End Of Sentence) character is no

Sahil Lamba 1 Dec 20, 2021
Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly

Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly Code for this paper Ultra-Data-Efficient GAN Tra

VITA 77 Oct 05, 2022
PSML: A Multi-scale Time-series Dataset for Machine Learning in Decarbonized Energy Grids

PSML: A Multi-scale Time-series Dataset for Machine Learning in Decarbonized Energy Grids The electric grid is a key enabling infrastructure for the a

Texas A&M Engineering Research 19 Jan 07, 2023
An addernet CUDA version

Training addernet accelerated by CUDA Usage cd adder_cuda python setup.py install cd .. python main.py Environment pytorch 1.10.0 CUDA 11.3 benchmark

LingXY 4 Jun 20, 2022
Lucid Sonic Dreams syncs GAN-generated visuals to music.

Lucid Sonic Dreams Lucid Sonic Dreams syncs GAN-generated visuals to music. By default, it uses NVLabs StyleGAN2, with pre-trained models lifted from

731 Jan 02, 2023
Specification language for generating Generalized Linear Models (with or without mixed effects) from conceptual models

tisane Tisane: Authoring Statistical Models via Formal Reasoning from Conceptual and Data Relationships TL;DR: Analysts can use Tisane to author gener

Eunice Jun 11 Nov 15, 2022
Experiments with the Robust Binary Interval Search (RBIS) algorithm, a Query-Based prediction algorithm for the Online Search problem.

OnlineSearchRBIS Online Search with Best-Price and Query-Based Predictions This is the implementation of the Robust Binary Interval Search (RBIS) algo

S. K. 1 Apr 16, 2022