15
15
// TODO: Remove this file after 0.4.
16
16
17
17
public extension Tensor where Scalar == Int32 {
18
- /// Creates a tensor with the specified shape, randomly sampling scalar values from a discrete
18
+ /// Creates a tensor with the specified shape, randomly sampling scalar values from a discrete
19
19
/// uniform distribution.
20
20
///
21
21
/// - Parameters:
@@ -40,7 +40,7 @@ public extension Tensor where Scalar == Int32 {
40
40
self . init ( shape: shape, scalars: scalars)
41
41
}
42
42
43
- /// Creates a tensor with the specified shape, randomly sampling scalar values from a discrete
43
+ /// Creates a tensor with the specified shape, randomly sampling scalar values from a discrete
44
44
/// uniform distribution, using the default random number generator.
45
45
///
46
46
/// - Parameters:
@@ -63,7 +63,7 @@ public extension Tensor where Scalar == Int32 {
63
63
64
64
public extension Tensor where Scalar: BinaryFloatingPoint ,
65
65
Scalar. RawSignificand: FixedWidthInteger {
66
- /// Creates a tensor with the specified shape, randomly sampling scalar values from a uniform
66
+ /// Creates a tensor with the specified shape, randomly sampling scalar values from a uniform
67
67
/// distribution between `lowerBound` and `upperBound`.
68
68
///
69
69
/// - Parameters:
@@ -89,7 +89,7 @@ public extension Tensor where Scalar: BinaryFloatingPoint,
89
89
self = ( upperBound - lowerBound) * sample + lowerBound
90
90
}
91
91
92
- /// Creates a tensor with the specified shape, randomly sampling scalar values from a normal
92
+ /// Creates a tensor with the specified shape, randomly sampling scalar values from a normal
93
93
/// distribution.
94
94
///
95
95
/// - Parameters:
@@ -128,7 +128,7 @@ public extension Tensor where Scalar: TensorFlowFloatingPoint {
128
128
let uniform = Tensor ( randomUniform: shape, generator: & generator)
129
129
self = Tensor . glorot ( fromStandardUniform: uniform, shape: shape)
130
130
}
131
-
131
+
132
132
/// Performs Glorot normal initialization for the specified shape, creating a tensor by
133
133
/// randomly sampling scalar values from a uniform distribution between `-limit` and `limit`,
134
134
/// where limit is `sqrt(2 / (fanIn + fanOut))` and `fanIn`/`fanOut` represent the number of
@@ -200,7 +200,11 @@ public extension Conv1D where Scalar.RawSignificand: FixedWidthInteger {
200
200
///
201
201
/// - Note: Use `init(filterShape:stride:padding:dilation:activation:seed:)` for faster random
202
202
/// initialization.
203
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
203
+ @available ( * , deprecated, message: """
204
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
205
+ `init(filterShape:stride:padding:dilation:activation:filterIntializer:biasInitializer:)`
206
+ instead.
207
+ """ )
204
208
init < G: RandomNumberGenerator > (
205
209
filterShape: ( Int , Int , Int ) ,
206
210
stride: Int = 1 ,
@@ -221,18 +225,22 @@ public extension Conv1D where Scalar.RawSignificand: FixedWidthInteger {
221
225
}
222
226
}
223
227
224
- public extension Conv1D {
225
- /// Creates a `Conv1D` layer with the specified filter shape, strides, padding, dilation and
226
- /// element-wise activation function. The filter tensor is initialized using Glorot uniform
227
- /// initialization with the specified seed. The bias vector is initialized with zeros.
228
+ public extension Conv1D {
229
+ /// Creates a `Conv1D` layer with the specified filter shape, strides, padding, dilation and
230
+ /// element-wise activation function. The filter tensor is initialized using Glorot uniform
231
+ /// initialization with the specified seed. The bias vector is initialized with zeros.
228
232
///
229
233
/// - Parameters:
230
- /// - filterShape: The 3-D shape of the filter, representing
234
+ /// - filterShape: The 3-D shape of the filter, representing
231
235
/// - padding: The padding algorithm for convolution.
232
236
/// - dilation: The dilation factor for the temporal dimension.
233
237
/// - activation: The element-wise activation function.
234
238
/// - seed: The random seed for initialization. The default value is random.
235
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
239
+ @available ( * , deprecated, message: """
240
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
241
+ `init(filterShape:stride:padding:dilation:activation:filterIntializer:biasInitializer:)`
242
+ instead.
243
+ """ )
236
244
init (
237
245
filterShape: ( Int , Int , Int ) ,
238
246
stride: Int = 1 ,
@@ -271,7 +279,11 @@ public extension Conv2D {
271
279
///
272
280
/// - Note: Use `init(filterShape:strides:padding:activation:seed:)` for faster random
273
281
/// initialization.
274
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
282
+ @available ( * , deprecated, message: """
283
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
284
+ `init(filterShape:strides:padding:dilations:activation:filterIntializer:biasInitializer:)`
285
+ instead.
286
+ """ )
275
287
init < G: RandomNumberGenerator > (
276
288
filterShape: ( Int , Int , Int , Int ) ,
277
289
strides: ( Int , Int ) = ( 1 , 1 ) ,
@@ -307,7 +319,11 @@ public extension Conv2D {
307
319
/// (dilation height, dilation width).
308
320
/// - activation: The element-wise activation function.
309
321
/// - seed: The random seed for initialization. The default value is random.
310
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
322
+ @available ( * , deprecated, message: """
323
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
324
+ `init(filterShape:strides:padding:dilations:activation:filterIntializer:biasInitializer:)`
325
+ instead.
326
+ """ )
311
327
init (
312
328
filterShape: ( Int , Int , Int , Int ) ,
313
329
strides: ( Int , Int ) = ( 1 , 1 ) ,
@@ -345,7 +361,10 @@ public extension Conv3D {
345
361
///
346
362
/// - Note: Use `init(filterShape:strides:padding:activation:seed:)` for faster random
347
363
/// initialization.
348
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
364
+ @available ( * , deprecated, message: """
365
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
366
+ `init(filterShape:strides:padding:activation:filterIntializer:biasInitializer:)` instead.
367
+ """ )
349
368
init < G: RandomNumberGenerator > (
350
369
filterShape: ( Int , Int , Int , Int , Int ) ,
351
370
strides: ( Int , Int , Int ) = ( 1 , 1 , 1 ) ,
@@ -378,7 +397,10 @@ public extension Conv3D {
378
397
/// - padding: The padding algorithm for convolution.
379
398
/// - activation: The element-wise activation function.
380
399
/// - seed: The random seed for initialization. The default value is random.
381
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
400
+ @available ( * , deprecated, message: """
401
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
402
+ `init(filterShape:strides:padding:activation:filterIntializer:biasInitializer:)` instead.
403
+ """ )
382
404
init (
383
405
filterShape: ( Int , Int , Int , Int , Int ) ,
384
406
strides: ( Int , Int , Int ) = ( 1 , 1 , 1 ) ,
@@ -412,7 +434,10 @@ public extension TransposedConv2D {
412
434
///
413
435
/// - Note: Use `init(filterShape:strides:padding:activation:seed:)` for faster random
414
436
/// initialization.
415
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
437
+ @available ( * , deprecated, message: """
438
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
439
+ `init(filterShape:strides:padding:activation:filterIntializer:biasInitializer:)` instead.
440
+ """ )
416
441
init < G: RandomNumberGenerator > (
417
442
filterShape: ( Int , Int , Int , Int ) ,
418
443
strides: ( Int , Int ) = ( 1 , 1 ) ,
@@ -443,7 +468,10 @@ public extension TransposedConv2D {
443
468
/// - padding: The padding algorithm for convolution.
444
469
/// - activation: The element-wise activation function.
445
470
/// - seed: The random seed for initialization. The default value is random.
446
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
471
+ @available ( * , deprecated, message: """
472
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
473
+ `init(filterShape:strides:padding:activation:filterIntializer:biasInitializer:)` instead.
474
+ """ )
447
475
init (
448
476
filterShape: ( Int , Int , Int , Int ) ,
449
477
strides: ( Int , Int ) = ( 1 , 1 ) ,
@@ -476,7 +504,10 @@ public extension DepthwiseConv2D {
476
504
///
477
505
/// - Note: Use `init(filterShape:strides:padding:activation:seed:)` for faster random
478
506
/// initialization.
479
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
507
+ @available ( * , deprecated, message: """
508
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
509
+ `init(filterShape:strides:padding:activation:filterIntializer:biasInitializer:)` instead.
510
+ """ )
480
511
init < G: RandomNumberGenerator > (
481
512
filterShape: ( Int , Int , Int , Int ) ,
482
513
strides: ( Int , Int ) = ( 1 , 1 ) ,
@@ -506,7 +537,10 @@ public extension DepthwiseConv2D {
506
537
/// - padding: The padding algorithm for convolution.
507
538
/// - activation: The element-wise activation function.
508
539
/// - seed: The random seed for initialization. The default value is random.
509
- @available ( * , deprecated, message: " This API will be removed after Swift for TensorFlow 0.4. " )
540
+ @available ( * , deprecated, message: """
541
+ This API will be removed after Swift for TensorFlow 0.4, please consider using
542
+ `init(filterShape:strides:padding:activation:filterIntializer:biasInitializer:)` instead.
543
+ """ )
510
544
init (
511
545
filterShape: ( Int , Int , Int , Int ) ,
512
546
strides: ( Int , Int ) = ( 1 , 1 ) ,
0 commit comments