@@ -44,106 +44,127 @@ extension Tensor: ElementaryFunctions where Scalar: TensorFlowFloatingPoint {
44
44
///
45
45
/// For real types, if `x` is negative the result is `.nan`. For complex
46
46
/// types there is a branch cut on the negative real axis.
47
+ @differentiable
47
48
public static func sqrt( _ x: Self ) -> Self {
48
49
TensorFlow . sqrt ( x)
49
50
}
50
51
51
52
/// The cosine of `x`, interpreted as an angle in radians.
53
+ @differentiable
52
54
public static func cos( _ x: Self ) -> Self {
53
55
TensorFlow . cos ( x)
54
56
}
55
57
56
58
/// The sine of `x`, interpreted as an angle in radians.
59
+ @differentiable
57
60
public static func sin( _ x: Self ) -> Self {
58
61
TensorFlow . sin ( x)
59
62
}
60
63
61
64
/// The tangent of `x`, interpreted as an angle in radians.
65
+ @differentiable
62
66
public static func tan( _ x: Self ) -> Self {
63
67
TensorFlow . tan ( x)
64
68
}
65
69
66
70
/// The inverse cosine of `x` in radians.
71
+ @differentiable
67
72
public static func acos( _ x: Self ) -> Self {
68
73
TensorFlow . acos ( x)
69
74
}
70
75
71
76
/// The inverse sine of `x` in radians.
77
+ @differentiable
72
78
public static func asin( _ x: Self ) -> Self {
73
79
TensorFlow . asin ( x)
74
80
}
75
81
76
82
/// The inverse tangent of `x` in radians.
83
+ @differentiable
77
84
public static func atan( _ x: Self ) -> Self {
78
85
TensorFlow . atan ( x)
79
86
}
80
87
81
88
/// The hyperbolic cosine of `x`.
89
+ @differentiable
82
90
public static func cosh( _ x: Self ) -> Self {
83
91
TensorFlow . cosh ( x)
84
92
}
85
93
86
94
/// The hyperbolic sine of `x`.
95
+ @differentiable
87
96
public static func sinh( _ x: Self ) -> Self {
88
97
TensorFlow . sinh ( x)
89
98
}
90
99
91
100
/// The hyperbolic tangent of `x`.
101
+ @differentiable
92
102
public static func tanh( _ x: Self ) -> Self {
93
103
TensorFlow . tanh ( x)
94
104
}
95
105
96
106
/// The inverse hyperbolic cosine of `x`.
107
+ @differentiable
97
108
public static func acosh( _ x: Self ) -> Self {
98
109
TensorFlow . acosh ( x)
99
110
}
100
111
101
112
/// The inverse hyperbolic sine of `x`.
113
+ @differentiable
102
114
public static func asinh( _ x: Self ) -> Self {
103
115
TensorFlow . asinh ( x)
104
116
}
105
117
106
118
/// The inverse hyperbolic tangent of `x`.
119
+ @differentiable
107
120
public static func atanh( _ x: Self ) -> Self {
108
121
TensorFlow . atanh ( x)
109
122
}
110
123
111
124
/// The exponential function applied to `x`, or `e**x`.
125
+ @differentiable
112
126
public static func exp( _ x: Self ) -> Self {
113
127
TensorFlow . exp ( x)
114
128
}
115
129
116
130
/// Two raised to to power `x`.
131
+ @differentiable
117
132
public static func exp2( _ x: Self ) -> Self {
118
133
TensorFlow . exp2 ( x)
119
134
}
120
135
121
136
/// Ten raised to to power `x`.
137
+ @differentiable
122
138
public static func exp10( _ x: Self ) -> Self {
123
139
TensorFlow . exp10 ( x)
124
140
}
125
141
126
142
/// `exp(x) - 1` evaluated so as to preserve accuracy close to zero.
143
+ @differentiable
127
144
public static func expm1( _ x: Self ) -> Self {
128
145
TensorFlow . expm1 ( x)
129
146
}
130
147
131
148
/// The natural logarithm of `x`.
149
+ @differentiable
132
150
public static func log( _ x: Self ) -> Self {
133
151
TensorFlow . log ( x)
134
152
}
135
153
136
154
/// The base-two logarithm of `x`.
155
+ @differentiable
137
156
public static func log2( _ x: Self ) -> Self {
138
157
TensorFlow . log2 ( x)
139
158
}
140
159
141
160
/// The base-ten logarithm of `x`.
161
+ @differentiable
142
162
public static func log10( _ x: Self ) -> Self {
143
163
TensorFlow . log10 ( x)
144
164
}
145
165
146
166
/// `log(1 + x)` evaluated so as to preserve accuracy close to zero.
167
+ @differentiable
147
168
public static func log1p( _ x: Self ) -> Self {
148
169
TensorFlow . log1p ( x)
149
170
}
@@ -930,14 +951,14 @@ internal func _vjpExp<T: TensorFlowFloatingPoint>(
930
951
931
952
/// Returns two raised to the power of the specified tensor element-wise.
932
953
@inlinable
933
- // @differentiable
954
+ @differentiable
934
955
public func exp2< T: TensorFlowFloatingPoint > ( _ x: Tensor < T > ) -> Tensor < T > {
935
956
pow ( 2 , x)
936
957
}
937
958
938
959
/// Returns ten raised to the power of the specified tensor element-wise.
939
960
@inlinable
940
- // @differentiable
961
+ @differentiable
941
962
public func exp10< T: TensorFlowFloatingPoint > ( _ x: Tensor < T > ) -> Tensor < T > {
942
963
pow ( 10 , x)
943
964
}
0 commit comments