From f281b981eab9bfca9a3e213aca45904961fae228 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Wed, 30 Aug 2023 17:35:23 +0200 Subject: [PATCH] added multiply --- teng_ml/util/transform.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/teng_ml/util/transform.py b/teng_ml/util/transform.py index db78cc6..971c704 100644 --- a/teng_ml/util/transform.py +++ b/teng_ml/util/transform.py @@ -1,5 +1,6 @@ import numpy as np from scipy.interpolate import interp1d +from torch import mul class Normalize: """ @@ -41,6 +42,15 @@ class NormalizeAmplitude: return f"NormalizeAmplitude(high={self.high})" +class Multiply: + def __init__(self, multiplier): + self.multiplier = multiplier + def __call__(self, data): + return data * self.multiplier + def __repr__(self): + return f"Multiply(multiplier={self.multiplier})" + + class ConstantInterval: """ Interpolate the data to have a constant interval / sample rate,