Operators

Abs

layer eddl::Abs(layer l)

Computes the element-wise absolute value of the given input tensor.

Parameters

l – Parent layer

Returns

Parent layer l after computing the element-wise absolute value

Example:

l = Abs(l);

Addition

layer eddl::Add(layer l1, layer l2)

Layer that computes the sum of two layers.

Parameters
  • l1 – Layer

  • l2 – Layer

Returns

The result after computing the sum of layers l1 and l2

Example:

layer l = Add(l1, l2); // l1 and l2 are layers with the same shape
layer eddl::Add(layer l1, float k)

Layer that computes the sum of a float number and a layer.

Parameters
  • l1 – Parent layer

  • k – Number

Returns

Parent layer l1 after computing its sum with k

Example:

l = Add(l, 0.5);
layer eddl::Add(float k, layer l1)

Example:

l = Add(0.5, l);

Clamp / Clip

Clamps all elements in input into the range [min, max].

layer eddl::Clamp(layer parent, float min, float max, string name = "")

Clamps all elements in input into the range [ min, max ].

Parameters
  • parent – Parent layer

  • min – Lower-bound of the range to be clamped to

  • max – Upper-bound of the range to be clamped to

  • name – A name for the operation

Returns

Output of reshape operation

Example:

l = Clamp(l, -100, 100);

Division

layer eddl::Div(layer l1, layer l2)

Layer that computes the element-wise division of two layers.

Parameters
  • l1 – Layer

  • l2 – Layer

Returns

Element-wise division of l1 and l2

Example:

layer l = Div(l1, l2); // l1 and l2 are layers with the same shape
layer eddl::Div(layer l1, float k)

Layer that computes the division of a layer by a float number.

Parameters
  • l1 – Parent layer

  • k – Number

Returns

Parent layer l1 after dividing it by k

Example:

l = Div(l, 0.5);
layer eddl::Div(float k, layer l1)

Example:

l = Div(0.5, l);

Exponent

layer eddl::Exp(layer l)

Returns a new tensor with the exponential of the elements of the input tensor.

Parameters

l – Parent layer

Returns

The exponential of l

Example:

l = Exp(l);

Logarithm (natural)

layer eddl::Log(layer l)

Layer that computes the logarithm of a layer.

Parameters

l – Parent layer

Returns

Parent layer l after computing its logarithm

Example:

l = Log(l);

Logarithm base 2

layer eddl::Log2(layer l)

Layer that computes the logarithm to base 2 of a layer.

Parameters

l – Parent layer

Returns

Parent layer l after computing its logarithm to base 2

Example:

l = Log2(l);

Logarithm base 10

layer eddl::Log10(layer l)

Layer that computes the logarithm to base 10 of a layer.

Parameters

l – Parent layer

Returns

Parent layer l after computing its logarithm to base 10

Example:

l = Log10(l);

Multiplication

layer eddl::Mult(layer l1, layer l2)

Layer that computes the element-wise multiplication of two layers.

Parameters
  • l1 – Layer

  • l2 – Layer

Returns

Result of the element-wise multiplication of l1 and l2

Example:

layer l = Mult(l1, l2); // l1 and l2 are layers with the same shape
layer eddl::Mult(layer l1, float k)

Layer that computes the multiplication of a float number and a layer.

Parameters
  • l1 – Parent layer

  • k – Number

Returns

Parent layer l1 after multiplying its elements by k

Example:

l = Mult(l, 2.0);
layer eddl::Mult(float k, layer l1)

Example:

layer l = Mult(0.5, l);

Power

layer eddl::Pow(layer l1, float k)

Layer that computes the power of a layer raised to a float number.

Parameters
  • l1 – Parent layer

  • k – Number

Returns

Parent layer l1 after computing its power raised to k

layer l1 = GaussGenerator(0.0, 1, {3, 32, 32});
layer l2 = GaussGenerator(0.0, 1, {3, 32, 32});

layer l = Pow(l1, l2);

//We can use the constant version for raising a layer to a constant exponent
layer l = Pow(l1, 3)

Sqrt

layer eddl::Sqrt(layer l)

Layer that computes the square root of a layer.

Parameters

l – Parent layer

Returns

Result of the square root of l

Example:

l = Sqrt(l);

Subtraction

layer eddl::Sub(layer l1, layer l2)

Layer that computes the difference of two layers.

Parameters
  • l1 – Layer

  • l2 – Layer

Returns

Difference between l1 and l2

Example:

layer l = Sub(l1, l2); // l1 and l2 are layers with the same shape
layer eddl::Sub(layer l1, float k)

Layer that computes the difference of a layer and a float number.

Parameters
  • l1 – Parent layer

  • k – Number

Returns

Parent layer l1 after computing its difference with k

Example:

l = Sub(l, 0.5);
layer eddl::Sub(float k, layer l1)

Example:

l = Sub(0.5, l);