forked from SciSharp/Tensor.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClamp.cs
More file actions
18 lines (17 loc) · 861 Bytes
/
Copy pathClamp.cs
File metadata and controls
18 lines (17 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using Tensornet.Common;
namespace Tensornet.Math{
public static partial class MathT{
public static Tensor<double> Clamp(Tensor<double> inp, double min, double max){
return OnElemOperation.Execute<double, double>(inp, x => System.Math.Clamp(x, min, max));
}
public static Tensor<float> Clamp(Tensor<float> inp, float min, float max){
return OnElemOperation.Execute<float, float>(inp, x => System.Math.Clamp(x, min, max));
}
public static Tensor<long> Clamp(Tensor<long> inp, long min, long max){
return OnElemOperation.Execute<long, long>(inp, x => System.Math.Clamp(x, min, max));
}
public static Tensor<int> Clamp(Tensor<int> inp, int min, int max){
return OnElemOperation.Execute<int, int>(inp, x => System.Math.Clamp(x, min, max));
}
}
}