Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mu-map
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tamino Huxohl
mu-map
Commits
e95e5b6f
Commit
e95e5b6f
authored
2 years ago
by
Tamino Huxohl
Browse files
Options
Downloads
Patches
Plain Diff
implement a scale tranform
parent
58c38ae5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mu_map/dataset/transform.py
+24
-0
24 additions, 0 deletions
mu_map/dataset/transform.py
with
24 additions
and
0 deletions
mu_map/dataset/transform.py
+
24
−
0
View file @
e95e5b6f
...
@@ -34,3 +34,27 @@ class SequenceTransform(Transform):
...
@@ -34,3 +34,27 @@ class SequenceTransform(Transform):
for
transforms
in
self
.
transforms
:
for
transforms
in
self
.
transforms
:
inputs
,
outputs_expected
=
transforms
(
inputs
,
outputs_expected
)
inputs
,
outputs_expected
=
transforms
(
inputs
,
outputs_expected
)
return
inputs
,
outputs_expected
return
inputs
,
outputs_expected
class
ScaleTransform
(
Transform
):
"""
A transformer that scales the inputs and outputs by pre-defined factors.
"""
def
__init__
(
self
,
scale_inputs
:
float
=
1.0
,
scale_outputs
:
float
=
1.0
):
"""
Initialize a scale transformer.
:param scale_inputs: the scale multiplied to the inputs
:param scale_outputs: the scale multiplied to the outputs
"""
self
.
scale_inputs
=
scale_inputs
self
.
scale_outputs
=
scale_outputs
def
__call__
(
self
,
inputs
:
Tensor
,
outputs_expected
:
Tensor
)
->
Tuple
[
Tensor
,
Tensor
]:
"""
Scale the inputs and the outputs by the factors defined in the constructor.
"""
return
inputs
*
self
.
scale_inputs
,
outputs_expected
*
self
.
scale_outputs
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment