question on trax

joseph pareti joepareti54 at gmail.com
Wed Aug 18 11:59:56 EDT 2021


yes, but I do not see Fn anywhere.

Another question is on this line:
z = add((x, y))
If I code:
z = add(x, y)
Then the following exception occurs :

*Expected input to be a tuple or list; instead got <class 'numpy.ndarray'>.*


Am Di., 17. Aug. 2021 um 19:21 Uhr schrieb MRAB <python at mrabarnett.plus.com
>:

> 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'.
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Regards,
Joseph Pareti - Artificial Intelligence consultant
Joseph Pareti's AI Consulting Services
https://www.joepareti54-ai.com/
cell +49 1520 1600 209
cell +39 339 797 0644


More information about the Python-list mailing list