# Machine Learning

**URL:** https://discourse.julialang.org/c/domain/ml/24.md?page=34

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 35

---

## [RNN only works with Float32?](https://discourse.julialang.org/t/rnn-only-works-with-float32/62292)

<div class="topic-metadata">

**Author:** [@EdgarHR](https://discourse.julialang.org/u/EdgarHR)\
**Replies:** 1\
**Last updated:** [June 2, 2021, 7:11pm UTC](https://discourse.julialang.org/t/rnn-only-works-with-float32/62292 "2021-06-02T19:11:09Z")

</div>

Hello everyone, I wanted to build an RNN model and it seems to be the case that Flux only accepts Float32 as inputs. For instance if I run the following code using Flux rnn = RNN(1,1) rnn(\[1\]) # Gives error rnn(\[conver…

---

## [Custom RNN cell. Help needed to improve performance](https://discourse.julialang.org/t/custom-rnn-cell-help-needed-to-improve-performance/60536)

<div class="topic-metadata">

**Author:** [@lungd](https://discourse.julialang.org/u/lungd)\
**Replies:** 1\
**Last updated:** [June 2, 2021, 5:10pm UTC](https://discourse.julialang.org/t/custom-rnn-cell-help-needed-to-improve-performance/60536 "2021-06-02T17:10:02Z")

</div>

I am working on an implementation of a sparsely connected RNN cell. The training of the cell is very slow. My code is not completely type stable and there are for sure some rookie mistakes as well. I hope that this is t…

---

## [Flux: training loop logging for custom structure and model](https://discourse.julialang.org/t/flux-training-loop-logging-for-custom-structure-and-model/62211)

<div class="topic-metadata">

**Author:** [@jgbrasier](https://discourse.julialang.org/u/jgbrasier)\
**Replies:** 7\
**Last updated:** [June 2, 2021, 9:41am UTC](https://discourse.julialang.org/t/flux-training-loop-logging-for-custom-structure-and-model/62211 "2021-06-02T09:41:27Z")

</div>

Hello everyone I am pretty new to using Julia for ML. I am training a custom model (Kalman Filter) that is a mutable structure. I am trying to update and log the parameters at each time step (in my case for each measure…

---

## [What are the currrent options for deep learning on an AMD GPU using Julia?](https://discourse.julialang.org/t/what-are-the-currrent-options-for-deep-learning-on-an-amd-gpu-using-julia/62168)

<div class="topic-metadata">

**Author:** [@DorianT](https://discourse.julialang.org/u/DorianT)\
**Replies:** 0\
**Last updated:** [June 1, 2021, 12:51am UTC](https://discourse.julialang.org/t/what-are-the-currrent-options-for-deep-learning-on-an-amd-gpu-using-julia/62168 "2021-06-01T00:51:56Z")

</div>

Hello everyone, I am quite new to Julia and the last few days wondering how I should go about my next project which will involve training word embedding models and performing various downstream tasks afterwards. I would…

---

## [BatchNorm: only track\_stats=true supported on gpu](https://discourse.julialang.org/t/batchnorm-only-track-stats-true-supported-on-gpu/62091)

<div class="topic-metadata">

**Author:** [@ymtoo](https://discourse.julialang.org/u/ymtoo)\
**Replies:** 3\
**Last updated:** [May 31, 2021, 5:17am UTC](https://discourse.julialang.org/t/batchnorm-only-track-stats-true-supported-on-gpu/62091 "2021-05-31T05:17:30Z")

</div>

Not able to use BatchNorm with track\_stats=false on GPU. julia\> using Flux julia\> model = Chain(Dense(10,5),BatchNorm(5,relu; track\_stats=false)) Chain(Dense(10, 5), BatchNorm(5, relu)) julia\> modelgpu = gpu(model) Ch…

---

## [Flux: reproducibility of GPU experiments](https://discourse.julialang.org/t/flux-reproducibility-of-gpu-experiments/62092)

<div class="topic-metadata">

**Author:** [@Rasmus\_Hoier](https://discourse.julialang.org/u/Rasmus_Hoier)\
**Replies:** 1\
**Last updated:** [May 30, 2021, 5:41pm UTC](https://discourse.julialang.org/t/flux-reproducibility-of-gpu-experiments/62092 "2021-05-30T17:41:00Z")

</div>

When I run the Flux model-zoo’s conv\_mnist.jl example there is an argument “seed” which should assure reproducibility (when larger than 0 ). This seems to only work when performing experiments on CPU, whereas GPU experim…

---

## [How to train/predict a very simple feed-forward neural network in Flux?](https://discourse.julialang.org/t/how-to-train-predict-a-very-simple-feed-forward-neural-network-in-flux/39534)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 6\
**Last updated:** [May 26, 2021, 8:42pm UTC](https://discourse.julialang.org/t/how-to-train-predict-a-very-simple-feed-forward-neural-network-in-flux/39534 "2021-05-26T20:42:40Z")

</div>

I must be idiot but I can’t realise how to do very basic… no Convolution, RNN, gates,… just a basic plain feed-forward neural network design/testing/validation in Flux. Somethink like: l1 = FullyConnectedLayer(tanh,2,3…

---

## [How to solve Ax=b, with A,x,b are matrix](https://discourse.julialang.org/t/how-to-solve-ax-b-with-a-x-b-are-matrix/61663)

<div class="topic-metadata">

**Author:** [@Van\_Kh\_i\_Ph\_m](https://discourse.julialang.org/u/Van_Kh_i_Ph_m)\
**Replies:** 12\
**Last updated:** [May 23, 2021, 4:16pm UTC](https://discourse.julialang.org/t/how-to-solve-ax-b-with-a-x-b-are-matrix/61663 "2021-05-23T16:16:10Z")

</div>

How to solve Ax=b, with A,x,b are matrix And, Can anyone help me solve this function with Newton method with backtracking line search ?

---

## [DiffEqFlux: SOSRA2() algorithm + BacksolveAdjoint() gives an error](https://discourse.julialang.org/t/diffeqflux-sosra2-algorithm-backsolveadjoint-gives-an-error/61237)

<div class="topic-metadata">

**Author:** [@SvenDummer](https://discourse.julialang.org/u/SvenDummer)\
**Replies:** 2\
**Last updated:** [May 23, 2021, 8:36am UTC](https://discourse.julialang.org/t/diffeqflux-sosra2-algorithm-backsolveadjoint-gives-an-error/61237 "2021-05-23T08:36:00Z")

</div>

Hi everyone. I have a question related to fitting a Neural SDE using DiffEqFlux.jl. Description of the problem that is solved: Given a specific SDE system, I want to steer that system (with a particular control) to the…

---

## [Convolutional Bayesian Neural Networks](https://discourse.julialang.org/t/convolutional-bayesian-neural-networks/61650)

<div class="topic-metadata">

**Author:** [@sapo](https://discourse.julialang.org/u/sapo)\
**Replies:** 7\
**Last updated:** [May 22, 2021, 7:51pm UTC](https://discourse.julialang.org/t/convolutional-bayesian-neural-networks/61650 "2021-05-22T19:51:35Z")

</div>

Hello, I need to implement convolutional and partly bayesian neural networks. I looked into Turing.jl but it looks like it still doesn’t provide such option. Any suggestion?

---

## [Reusing exact same layer and parameters](https://discourse.julialang.org/t/reusing-exact-same-layer-and-parameters/61618)

<div class="topic-metadata">

**Author:** [@crinders](https://discourse.julialang.org/u/crinders)\
**Replies:** 3\
**Last updated:** [May 22, 2021, 2:27pm UTC](https://discourse.julialang.org/t/reusing-exact-same-layer-and-parameters/61618 "2021-05-22T14:27:46Z")

</div>

I want to reuse the exact same layer in a network. But I can’t figure out whether my naive approach will do that. My toy architecture is using Flux D1 = Dense(2,2) D2 = Dense(2,2) NaiveReuse = Chain(D1, Parallel(vcat,Ch…

---

## [Cannot locate artifact 'libknet8' in KNet](https://discourse.julialang.org/t/cannot-locate-artifact-libknet8-in-knet/61631)

<div class="topic-metadata">

**Author:** [@gforchini](https://discourse.julialang.org/u/gforchini)\
**Replies:** 0\
**Last updated:** [May 22, 2021, 10:10am UTC](https://discourse.julialang.org/t/cannot-locate-artifact-libknet8-in-knet/61631 "2021-05-22T10:10:09Z")

</div>

Hello, I have downloaded Knet from https://github.com/denizyuret/Knet.jl (but I have the same problem when I download Knet with Pkg.add(“Knet”)) to a Nvidia Jetson Nano (as it is an inexpensive method to finalise a Mon…

---

## [Gradient of Flux model wrt to weights](https://discourse.julialang.org/t/gradient-of-flux-model-wrt-to-weights/61405)

<div class="topic-metadata">

**Author:** [@edwinb-ai](https://discourse.julialang.org/u/edwinb-ai)\
**Replies:** 4\
**Last updated:** [May 19, 2021, 10:18pm UTC](https://discourse.julialang.org/t/gradient-of-flux-model-wrt-to-weights/61405 "2021-05-19T22:18:02Z")

</div>

Hello everyone. I’m attempting to obtain the gradient of a Flux model wrt to the weights. I first want to show what I mean (or want to achieve). Suppose I have a very simple linear model such that y(x)=W \\cdot x + b…

---

## [ML julia package incorporating Restricted Boltzmann Machine models?](https://discourse.julialang.org/t/ml-julia-package-incorporating-restricted-boltzmann-machine-models/61344)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 5\
**Last updated:** [May 18, 2021, 9:29pm UTC](https://discourse.julialang.org/t/ml-julia-package-incorporating-restricted-boltzmann-machine-models/61344 "2021-05-18T21:29:41Z")

</div>

Hi folks, just a simple question: is there/what is the best neural networks package that implements (Restricted) Boltzmann Machines as a model? I know there are specific packages for that, but I’m looking for something …

---

## [Flux.params of a matrix implemented as a struct](https://discourse.julialang.org/t/flux-params-of-a-matrix-implemented-as-a-struct/60787)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 11\
**Last updated:** [May 17, 2021, 7:09am UTC](https://discourse.julialang.org/t/flux-params-of-a-matrix-implemented-as-a-struct/60787 "2021-05-17T07:09:16Z")

</div>

Dear All, I have a student who is implementing few algorithms for distributed optimization (training of neural networks) using Flux / Zygote tooling. We have been tracking various sources of inefficiencies and I have f…

---

## [DiffEqFlux: an error when using NN's that take both time and position as input](https://discourse.julialang.org/t/diffeqflux-an-error-when-using-nns-that-take-both-time-and-position-as-input/60937)

<div class="topic-metadata">

**Author:** [@SvenDummer](https://discourse.julialang.org/u/SvenDummer)\
**Replies:** 6\
**Last updated:** [May 11, 2021, 11:29am UTC](https://discourse.julialang.org/t/diffeqflux-an-error-when-using-nns-that-take-both-time-and-position-as-input/60937 "2021-05-11T11:29:55Z")

</div>

Hi everyone, I am new to the Julia programming language and ran into an error when programming. My problem: I would like to solve a ODE optimal control problem with a neural network based approach. I take the ODE and r…

---

## [MLJ - user defined models - supporting weights - issue?](https://discourse.julialang.org/t/mlj-user-defined-models-supporting-weights-issue/60801)

<div class="topic-metadata">

**Author:** [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Replies:** 4\
**Last updated:** [May 10, 2021, 9:51pm UTC](https://discourse.julialang.org/t/mlj-user-defined-models-supporting-weights-issue/60801 "2021-05-10T21:51:54Z")

</div>

Hi- I’ve been using MLJ successfully to create some simple custom models using the MLJModelInterface. Recently, I’ve attempted to expand the models to support sample weights for the purpose of implementing a simple adap…

---

## [In MLJ, what does \`fit!\` do exactly?](https://discourse.julialang.org/t/in-mlj-what-does-fit-do-exactly/60750)

<div class="topic-metadata">

**Author:** [@ablaom](https://discourse.julialang.org/u/ablaom)\
**Replies:** 1\
**Last updated:** [May 7, 2021, 11:44pm UTC](https://discourse.julialang.org/t/in-mlj-what-does-fit-do-exactly/60750 "2021-05-07T23:44:30Z")

</div>

A query posted on slack: Hello! I’m using MLJ to train a classifier but I’m not sure to correctly understand how successive trains “stack”, i.e. what happens when we call fit!() several times (it says “machine has been …

---

## [Prefetch data in a separate thread (or why adding a single print leads to a 2x performance)](https://discourse.julialang.org/t/prefetch-data-in-a-separate-thread-or-why-adding-a-single-print-leads-to-a-2x-performance/60225)

<div class="topic-metadata">

**Author:** [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Replies:** 5\
**Last updated:** [May 7, 2021, 6:37am UTC](https://discourse.julialang.org/t/prefetch-data-in-a-separate-thread-or-why-adding-a-single-print-leads-to-a-2x-performance/60225 "2021-05-07T06:37:08Z")

</div>

I am training a neural network where some significant time is spent on the data preparation on the CPU (data augmentation). This results in a relatively low GPU utilization overall because the GPU has to wait for the dat…

---

## [ArrayFire vs AbstractArray performance and future in julia](https://discourse.julialang.org/t/arrayfire-vs-abstractarray-performance-and-future-in-julia/60533)

<div class="topic-metadata">

**Author:** [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Replies:** 7\
**Last updated:** [May 5, 2021, 6:00pm UTC](https://discourse.julialang.org/t/arrayfire-vs-abstractarray-performance-and-future-in-julia/60533 "2021-05-05T18:00:34Z")

</div>

So I recently ran into ArrayFire and it’s Julia wrapper ArrayFire.jl and was impressed by the performance benchmark. I have not tried it myself and I was wondering if anyone has made any experiments with it and if it’s c…

---

## [Defining MLJ pipelines within a function](https://discourse.julialang.org/t/defining-mlj-pipelines-within-a-function/60552)

<div class="topic-metadata">

**Author:** [@ablaom](https://discourse.julialang.org/u/ablaom)\
**Replies:** 3\
**Last updated:** [May 5, 2021, 5:06pm UTC](https://discourse.julialang.org/t/defining-mlj-pipelines-within-a-function/60552 "2021-05-05T17:06:22Z")

</div>

Question asked on slack: Hello, I’m new to Julia and MLJ. Is there a recommended way to compose models within functions? I tried placing the code from the “ Lightning Tour ” within a function of my own package, however…

---

## [Is there a way to avoid allocations when calling a Flux model? Especially on a GPU](https://discourse.julialang.org/t/is-there-a-way-to-avoid-allocations-when-calling-a-flux-model-especially-on-a-gpu/60279)

<div class="topic-metadata">

**Author:** [@jmair](https://discourse.julialang.org/u/jmair)\
**Replies:** 5\
**Last updated:** [May 4, 2021, 4:47pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-avoid-allocations-when-calling-a-flux-model-especially-on-a-gpu/60279 "2021-05-04T16:47:18Z")

</div>

When using Flux, especially with CUDA, each inference call uses a lot of allocations, particularly on a GPU, below is an example: julia\> using Flux, CUDA; julia\> model\_cpu = Flux.Chain(Flux.Dense(2, 8), Flux.Dense(8,8)…

---

## [\`Chain\` vs \`foldl\` in Flux.jl](https://discourse.julialang.org/t/chain-vs-foldl-in-flux-jl/60136)

<div class="topic-metadata">

**Author:** [@dbg](https://discourse.julialang.org/u/dbg)\
**Replies:** 2\
**Last updated:** [April 28, 2021, 12:31am UTC](https://discourse.julialang.org/t/chain-vs-foldl-in-flux-jl/60136 "2021-04-28T00:31:01Z")

</div>

I am new to both ML and Julia, so this might be a silly question. I am trying to use foldl instead of Chain to create a model with multiple layers, but I am not able to train the model created using foldl. Does anyone kn…

---

## [Flux and chemistry](https://discourse.julialang.org/t/flux-and-chemistry/59742)

<div class="topic-metadata">

**Author:** [@aquarelleX332](https://discourse.julialang.org/u/aquarelleX332)\
**Replies:** 4\
**Last updated:** [April 26, 2021, 10:42pm UTC](https://discourse.julialang.org/t/flux-and-chemistry/59742 "2021-04-26T22:42:02Z")

</div>

Hello everyone, I am aware that ChemometricsTools.jl is a machine learning library for chemistry (mainly to process chemical data). Could you help me to find some examples of Flux application in chemistry (and possibl…

---

## [RNN is not trained](https://discourse.julialang.org/t/rnn-is-not-trained/59553)

<div class="topic-metadata">

**Author:** [@Sunny](https://discourse.julialang.org/u/Sunny)\
**Replies:** 6\
**Last updated:** [April 22, 2021, 5:31pm UTC](https://discourse.julialang.org/t/rnn-is-not-trained/59553 "2021-04-22T17:31:10Z")

</div>

I’m trying to reproduce this example but my model won’t train. I use only train dataset to achieve overfitting and get just a line as prediction: using Pandas using Plots using Flux df = read\_csv("airline-passengers.c…

---

## [Pros and cons of using Flux directly over using MLJ/MLJFlux](https://discourse.julialang.org/t/pros-and-cons-of-using-flux-directly-over-using-mlj-mljflux/59756)

<div class="topic-metadata">

**Author:** [@ablaom](https://discourse.julialang.org/u/ablaom)\
**Replies:** 2\
**Last updated:** [April 22, 2021, 12:07am UTC](https://discourse.julialang.org/t/pros-and-cons-of-using-flux-directly-over-using-mlj-mljflux/59756 "2021-04-22T00:07:28Z")

</div>

The following question has been posted on slack: “Can anyone guide me on the relative merits of using MLJ with MLJFlux vs. using Flux directly?”

---

## [Derivative with Zygote/ForwardDiff of a function of multiple vectors wrt a subset of arguments](https://discourse.julialang.org/t/derivative-with-zygote-forwarddiff-of-a-function-of-multiple-vectors-wrt-a-subset-of-arguments/59560)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 1\
**Last updated:** [April 21, 2021, 7:48pm UTC](https://discourse.julialang.org/t/derivative-with-zygote-forwarddiff-of-a-function-of-multiple-vectors-wrt-a-subset-of-arguments/59560 "2021-04-21T19:48:53Z")

</div>

I can differentiate a function of one vector, but not multiple vectors using ForwardDiff, Zygote f(x) = 3.0\*x\[1\] + 5.0\*x\[2\]^2.0 fpF(x) = ForwardDiff.gradient(f,x) fpZ(x) = Zygote.forward\_jacobian(f,x)\[2\] # xx = 2.0\*o…

---

## [ReverseDiff over Zygote to differentiate neural network using GalacticOptim - Dimension mismatch](https://discourse.julialang.org/t/reversediff-over-zygote-to-differentiate-neural-network-using-galacticoptim-dimension-mismatch/59744)

<div class="topic-metadata">

**Author:** [@RynoLaubscher](https://discourse.julialang.org/u/RynoLaubscher)\
**Replies:** 2\
**Last updated:** [April 21, 2021, 7:21pm UTC](https://discourse.julialang.org/t/reversediff-over-zygote-to-differentiate-neural-network-using-galacticoptim-dimension-mismatch/59744 "2021-04-21T19:21:16Z")

</div>

Hi All, I am struggling a bit with using GalacticOptim.AutoReverseDiff to find the gradients over a loss function which internally calculates a gradient using Zygote. Running ForwardDiff over the function works fine but …

---

## [3D convolution, de-convolution layers in Flux for training 3D MRI data](https://discourse.julialang.org/t/3d-convolution-de-convolution-layers-in-flux-for-training-3d-mri-data/11917)

<div class="topic-metadata">

**Author:** [@Azamat](https://discourse.julialang.org/u/Azamat)\
**Replies:** 4\
**Last updated:** [April 21, 2021, 3:54pm UTC](https://discourse.julialang.org/t/3d-convolution-de-convolution-layers-in-flux-for-training-3d-mri-data/11917 "2021-04-21T15:54:55Z")

</div>

Are there 3D convolution, de-convolution layers in Flux.jl? Or is there any implementation that can be used with Flux.jl? To elaborate I have 3D greyscale images (MRI scans), i.e. each voxel value is a number. Now is t…

---

## [Flux: implementing efficient RBF layer](https://discourse.julialang.org/t/flux-implementing-efficient-rbf-layer/59402)

<div class="topic-metadata">

**Author:** [@Rasmus\_Hoier](https://discourse.julialang.org/u/Rasmus_Hoier)\
**Replies:** 5\
**Last updated:** [April 21, 2021, 12:15pm UTC](https://discourse.julialang.org/t/flux-implementing-efficient-rbf-layer/59402 "2021-04-21T12:15:48Z")

</div>

Hi, I am new to Flux and could use some feedback on how to optimize some code. Using the source code for the Dense layer as a reference I made a radial basis function (RBF) layer. I am able to train networks using the …

[Previous page](https://discourse.julialang.org/c/domain/ml/24.md?page=33)

[Next page](https://discourse.julialang.org/c/domain/ml/24.md?page=35)
