# NeuralPDE passing current grid point the the loss and activation funciton

**URL:** <https://discourse.julialang.org/t/neuralpde-passing-current-grid-point-the-the-loss-and-activation-funciton/92729>\
**Category:** General Usage\
**Tags:** neural-network\
**Created:** [January 9, 2023, 8:13pm UTC](https://discourse.julialang.org/t/neuralpde-passing-current-grid-point-the-the-loss-and-activation-funciton/92729 "2023-01-09T20:13:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![c\_sell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c_sell/32/38854_2.png) [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Post date:** [January 9, 2023, 8:13pm UTC](https://discourse.julialang.org/t/neuralpde-passing-current-grid-point-the-the-loss-and-activation-funciton/92729/1 "2023-01-09T20:13:55Z")

</div>

Hello everyone,  
i have three questions regarding the NeuralPDE package:

- is it possible to pass the current grid point to the additional cost function? I would like to take the derivative at the boundary of the domain (I want to use it for a periodic boundary condition)
- Is it possible to passs the current grid point to a own activation function? I would like to to multiply the last layer with the function with x\_point \* (x\_point - l) to implement to additional bc in a diffrent way.
- is it also possible to use residual neural networks ?

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [January 10, 2023, 2:41am UTC](https://discourse.julialang.org/t/neuralpde-passing-current-grid-point-the-the-loss-and-activation-funciton/92729/2 "2023-01-10T02:41:34Z")

</div>

> [@c\_sell](#):
>
> is it possible to pass the current grid point to the additional cost function? I would like to take the derivative at the boundary of the domain (I want to use it for a periodic boundary condition)

I don’t understand how those are connected: just use the derivative in the boundary condition.

> [@c\_sell](#):
>
> is it also possible to use residual neural networks ?

Yes, just define the neural network to be a residual neural network. Any Flux or Lux model is fine.

> [@c\_sell](#):
>
> s it possible to passs the current grid point to a own activation function? I would like to to multiply the last layer with the function with x\_point \* (x\_point - l) to implement to additional bc in a diffrent way.

Yes, any Flux or Lux model is fine. So just define `model([x,y])` to do this by defining a Lux/Flux model that does it.
