forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRescaling.cs
More file actions
27 lines (24 loc) · 747 Bytes
/
Copy pathRescaling.cs
File metadata and controls
27 lines (24 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Tensorflow.Keras.ArgsDefinition;
using Tensorflow.Keras.Engine;
namespace Tensorflow.Keras.Layers
{
/// <summary>
/// Multiply inputs by `scale` and adds `offset`.
/// </summary>
public class Rescaling : Layer
{
RescalingArgs args;
Tensor scale;
Tensor offset;
public Rescaling(RescalingArgs args) : base(args)
{
this.args = args;
}
protected override Tensors Call(Tensors inputs, Tensor state = null, bool is_training = false)
{
scale = math_ops.cast(args.Scale, args.DType);
offset = math_ops.cast(args.Offset, args.DType);
return math_ops.cast(inputs, args.DType) * scale + offset;
}
}
}