question on trax
MRAB
python at mrabarnett.plus.com
Tue Aug 17 13:17:43 EDT 2021
On 2021-08-17 16:50, joseph pareti wrote:
> In the following code, where does tl.Fn come from? i see it nowhere in the
> documents, i.e I was looking for trax.layers.Fn :
>
> import numpy as np
> *from trax import layers as tl*
> from trax import shapes
> from trax import fastmath
> #
> def Addition():
> layer_name = "Addition" # don't forget to give your custom layer a
> name to identify
>
> # Custom function for the custom layer
> def func(x, y):
> return x + y
>
> return *tl.Fn*(layer_name, func)
>
[snip]
It comes from using the line:
from trax import layers as tl
so it's equivalent to 'trax.layers.Fn'.
More information about the Python-list
mailing list