sopr#

class diffsptk.ScalarOperation(operation, opt=None)[source]#

See this page for details.

Parameters
operation[‘Addition’, ‘Subtraction’, ‘Multiplication’, ‘Division’, ‘Remainder’, ‘Power’, ‘LowerBouding’, ‘UpperBouding’, ‘Absolute’, ‘Reciprocal’, ‘Square’, ‘SquareRoot’, ‘NaturalLogarithm’, ‘Logarithm2’, ‘Logarithm10’, ‘Logarithm’, ‘NaturalExponential’, ‘Exponential2’, ‘Exponential10’, ‘Exponential’, ‘Sine’, ‘Coine’, ‘Tangent’]

Operation.

optionfloat [scalar]

Optional argument.

forward(x)[source]#

Perform scalar operation.

Parameters
xTensor [shape=(…,)]

Input.

Returns
yTensor [shape=(…,)]

Output.

Examples

>>> x = diffsptk.ramp(4)
>>> sopr = diffsptk.ScalarOperation("Multiplication", 2)
>>> y = sopr(x)
>>> y
tensor([0., 2., 4., 6., 8.])