DotLayer
✖
DotLayer
Details and Options


- DotLayer is typically used inside NetGraph.
- DotLayer[…][{in1,in2,…}] explicitly computes the output from applying the layer.
- The inputs of DotLayer[…] should be arrays, and the output is effectively given by Dot[in1,in2,…].
- The output of DotLayer[{spec1,spec2,…}][{in1,in2,…}] is effectively given by Dot[Transpose[in1,spec1],Transpose[in2,spec2],…].
- The transpose specifications speci can be:
-
None no transposition m<->n transposes levels m and n {m1<->n1,m2<->n2,…} sequentially transposes levels mi and ni {n1,n2,…} transposes so that the k level in the input is the nk
level in the output
- Option InputPorts can be used to specify the number, names or shapes of input ports. If InputPorts is not specified, the number of ports and their shapes are inferred from NetChain or NetGraph connectivity.
- Besides input ports, DotLayer exposes the following ports for use in NetGraph etc.:
-
"Output" an array - Within a NetGraph, a DotLayer can be connected using a single edge of the form {src1,src2,…}dotlayer, where dotlayer is the name or index of the DotLayer, or as multiple separate edges given in the corresponding order, as src1dotlayer,src2dotlayer,…,srcndotlayer.
- The shapes of the inputs to DotLayer (after possible transposition) should be such that the last dimension of inputi is equal to the first dimension of inputi+1.
- Options[DotLayer] gives the list of default options to construct the layer. Options[DotLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[DotLayer[…]] gives a report about the layer.
- Information[DotLayer[…],prop] gives the value of the property prop of DotLayer[…]. Possible properties are the same as for NetGraph.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Create a DotLayer:

https://wolfram.com/xid/0b0k6vcf2aq-bi2g74

Apply the layer to two input vectors to produce a scalar:

https://wolfram.com/xid/0b0k6vcf2aq-ijgnob

Create a NetGraph that contains a DotLayer:

https://wolfram.com/xid/0b0k6vcf2aq-3hhbev


https://wolfram.com/xid/0b0k6vcf2aq-g72cll

Scope (6)Survey of the scope of standard use cases
Create a DotLayer that accepts specific sizes of input:

https://wolfram.com/xid/0b0k6vcf2aq-miss03

Take the dot product of two length-3 vectors:

https://wolfram.com/xid/0b0k6vcf2aq-1tizt8


https://wolfram.com/xid/0b0k6vcf2aq-y3icsz

Take the dot product of a 2×3 matrix and a length-3 vector:

https://wolfram.com/xid/0b0k6vcf2aq-0anoyo


https://wolfram.com/xid/0b0k6vcf2aq-ztr4ll

Take the dot product of two 2×2 matrices:

https://wolfram.com/xid/0b0k6vcf2aq-5n4zgu


https://wolfram.com/xid/0b0k6vcf2aq-pqbwpt

Take the dot product of three 2×2 matrices:

https://wolfram.com/xid/0b0k6vcf2aq-ekrnhj


https://wolfram.com/xid/0b0k6vcf2aq-450i3c

Take the dot product of one transposed matrix and another matrix:

https://wolfram.com/xid/0b0k6vcf2aq-gmb2f8


https://wolfram.com/xid/0b0k6vcf2aq-ogn1a0

Possible Issues (1)Common pitfalls and unexpected behavior
DotLayer cannot accept symbolic inputs:

https://wolfram.com/xid/0b0k6vcf2aq-ggaxyd


https://wolfram.com/xid/0b0k6vcf2aq-56whoo


Wolfram Research (2017), DotLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/DotLayer.html (updated 2021).
Text
Wolfram Research (2017), DotLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/DotLayer.html (updated 2021).
Wolfram Research (2017), DotLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/DotLayer.html (updated 2021).
CMS
Wolfram Language. 2017. "DotLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/DotLayer.html.
Wolfram Language. 2017. "DotLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/DotLayer.html.
APA
Wolfram Language. (2017). DotLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DotLayer.html
Wolfram Language. (2017). DotLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DotLayer.html
BibTeX
@misc{reference.wolfram_2025_dotlayer, author="Wolfram Research", title="{DotLayer}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/DotLayer.html}", note=[Accessed: 17-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_dotlayer, organization={Wolfram Research}, title={DotLayer}, year={2021}, url={https://reference.wolfram.com/language/ref/DotLayer.html}, note=[Accessed: 17-May-2025
]}