[JuMP] Inf, -Inf constraint 제거하기

JuMP constraint에 Inf, -Inf가 포함된 경우 이를 제거하는 방법을 아래 소개 한다. lower에 -Inf나 upper에 Inf가 있는 경우 예를 들어@constaint(m, x <= Inf) 를 하게 되면==> x + NaN <= Inf라는 식으로 constraint에 NaN이 포함되어 optimize시 error가 발생한다upper나 lower에 Inf, -Inf가 포함되는 경우 의미가 없기 때문에 에러를 발생 시키는게 아닐까 한다.따라서 사전에 그런 조건에 있는

[JuMP] Inf, -Inf constraint 제거하기 Read More »

[Flux] MNIST example update

수정부문: 기존accuracy(x,y) = mean(onecold(m(x) .== onecold(y))loss(x,y) = crossentropy(m(x),y) 변경# ϵ : loss함수가 NaN이 되는것을 방지ϵ = 1.0f-32loss(x,y) = crossentropy(m(x) .+ ϵ,y) # onecold가 GPU에서는 에러 발생 하기 때무에 아래로 대체참조 : https://github.com/FluxML/Flux.jl/issues/556 compare(y::OneHotMatrix, y′) = maximum(y′, dims = 1) .== maximum(y .* y′, dims = 1)accuracy(x, y::OneHotMatrix) = mean(compare(y, m(x))) mnist.jl

[Flux] MNIST example update Read More »

[Flux] RNN example – char_rnn_gpu_minibatch

https://github.com/FluxML/model-zoo/blob/master/text/char-rnn/char-rnn.jl 의 error fix 및 수정 확장본 환경 : Julia v1.3.1, Flux v0.10.1 char-rnn의 이해를 위한 jupyer notebook (html) –> click here github : https://github.com/mrchaos/model-zoo/blob/master/text/char-rnn/char_rnn_gpu_minibatch.jl char_rnn_gpu_minibatch.jl

[Flux] RNN example – char_rnn_gpu_minibatch Read More »

[Flux] model-zoo fix conv.jl

mnist에 cnn을 적용한 예제가 conv.jl인데 Flux v0.10.1에서 많은 문제가 발생하여 수정하고 몇가지 기능을 추가 했다. 원래 conv.jl : click here! 기존의 소스를 수정하여 새로 추가한 소스 : click here! conv_gpu_minibatch.jl cmd_parser.jl 기존 conv.jl 의 loss function이 아래와 같이 정의 되어 있는데 x_aug = x .+ 0.1f0*gpu(randn(eltype(x), size(x))) 에서 에러 발생 하여 loss를 아래 와 같이

[Flux] model-zoo fix conv.jl Read More »

[Flux] model-zoo tutorial with Zygote

Model-zoo 60분 튜토리얼 : https://github.com/FluxML/model-zoo/blob/master/tutorials/60-minute-blitz.jl 위의 모델은 Flux가 Tracker를 채택하고 있을 때 예제로서 개념은 좋으나 Flux 0.10.x 부터는 Zygote 기반이므로 재대로 동작 하지 않는다 위의 예제는 Flux v0.10.1 버전이며 Zygote 기반으로 수정한 버전이다. Jupyter note (html 버전) –> Click here

[Flux] model-zoo tutorial with Zygote Read More »