Skip to content

Commit

Permalink
Merge pull request #59 from TuringLang/devmotion-patch-1
Browse files Browse the repository at this point in the history
Update and fix CI tests
  • Loading branch information
mohamed82008 authored Apr 4, 2020
2 parents 14534fe + aa595c2 commit e0f0d13
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 71 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
name: CompatHelper

on:
# push:
schedule:
- cron: '00 * * * *'
- cron: '00 00 * * *'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.3]
julia-arch: [x86]
os: [ubuntu-latest]
CompatHelper:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Install dependencies
version: 1
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JULIA_DEBUG: CompatHelper
run: julia -e 'using CompatHelper; CompatHelper.main()'
28 changes: 15 additions & 13 deletions .github/workflows/ForwardDiff_Tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0, 1.3]
julia-arch: [x64, x86]
os: [ubuntu-latest, macOS-latest]
exclude:
- os: macOS-latest
julia-arch: x86

version:
- '1.0'
- '1'
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v1.0.0
- uses: julia-actions/setup-julia@latest
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-runtest@master
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
STAGE: ForwardDiff_Tracker
STAGE: ForwardDiff_Tracker
28 changes: 15 additions & 13 deletions .github/workflows/Others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0, 1.3]
julia-arch: [x64, x86]
os: [ubuntu-latest, macOS-latest]
exclude:
- os: macOS-latest
julia-arch: x86

version:
- '1.0'
- '1'
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v1.0.0
- uses: julia-actions/setup-julia@latest
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-runtest@master
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
STAGE: Others
STAGE: Others
28 changes: 15 additions & 13 deletions .github/workflows/ReverseDiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0, 1.3]
julia-arch: [x64, x86]
os: [ubuntu-latest, macOS-latest]
exclude:
- os: macOS-latest
julia-arch: x86

version:
- '1.0'
- '1'
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v1.0.0
- uses: julia-actions/setup-julia@latest
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-runtest@master
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
STAGE: ReverseDiff
STAGE: ReverseDiff
2 changes: 1 addition & 1 deletion .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
- cron: 0 0 * * *
jobs:
TagBot:
runs-on: ubuntu-latest
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/Zygote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.0, 1.3]
julia-arch: [x64, x86]
os: [ubuntu-latest, macOS-latest]
exclude:
- os: macOS-latest
julia-arch: x86

version:
- '1.0'
- '1'
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v1.0.0
- uses: julia-actions/setup-julia@latest
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-runtest@master
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
STAGE: Zygote
STAGE: Zygote
4 changes: 3 additions & 1 deletion src/reversediff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ include("reversediffx.jl")

import Distributions: Gamma
using .ReverseDiffX
using .ReverseDiffX: RTR, RTV, RTM
using .ReverseDiffX: RTR, RTV, RTM, RTA

PoissonBinomial(p::RTA{<:Real}; check_args=true) = TuringPoissonBinomial(p; check_args = check_args)

Gamma::RTR, θ::Real; check_args=true) = pgamma(α, θ, check_args = check_args)
Gamma::Real, θ::RTR; check_args=true) = pgamma(α, θ, check_args = check_args)
Expand Down
9 changes: 5 additions & 4 deletions src/univariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,17 @@ struct TuringPoissonBinomial{T<:Real, TV1<:AbstractVector{T}, TV2<:AbstractVecto
p::TV1
pmf::TV2
end
function TuringPoissonBinomial(p::AbstractArray{<:Real})
function TuringPoissonBinomial(p::AbstractArray{<:Real}; check_args = true)
pb = Distributions.poissonbinomial_pdf_fft(p)
@assert Distributions.isprobvec(pb)
TuringPoissonBinomial(p, pb)
ϵ = eps(eltype(pb))
check_args && @assert all(x -> x >= -ϵ, pb) && isapprox(sum(pb), 1, atol = ϵ)
return TuringPoissonBinomial(p, pb)
end
function logpdf(d::TuringPoissonBinomial{T}, k::Int) where T<:Real
insupport(d, k) ? log(d.pmf[k + 1]) : -T(Inf)
end
quantile(d::TuringPoissonBinomial, x::Float64) = quantile(Categorical(d.pmf), x) - 1
PoissonBinomial(p::TrackedArray) = TuringPoissonBinomial(p)
PoissonBinomial(p::TrackedArray{<:Real}; check_args=true) = TuringPoissonBinomial(p; check_args = check_args)
Base.minimum(d::TuringPoissonBinomial) = 0
Base.maximum(d::TuringPoissonBinomial) = length(d.p)

Expand Down

0 comments on commit e0f0d13

Please sign in to comment.