Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit 36686da

Browse files
Shashi456saeta
authored andcommitted
Updating convolution docs (#246)
1 parent 20a0923 commit 36686da

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

Sources/TensorFlow/Operators/NN.swift

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -384,50 +384,48 @@ func _vjpAvgPool3D<Scalar: TensorFlowFloatingPoint>(
384384
})
385385
}
386386

387-
/// Computes a 2-D convolution using `self` as input, with the specified
388-
/// filter, strides, and padding.
387+
/// Computes a 2-D convolution with the specified input, filter, strides, and padding.
389388
///
390389
/// - Parameters:
391-
/// - x: The input.
390+
/// - input: The input.
392391
/// - filter: The convolution filter.
393392
/// - strides: The strides of the sliding filter for each dimension of the input.
394393
/// - padding: The padding for the operation.
395-
/// - Precondition: `self` must have rank 4.
394+
/// - Precondition: `input` must have rank `4`.
396395
/// - Precondition: `filter` must have rank 4.
397-
@differentiable(wrt: (x, filter), vjp: _vjpConv2D)
396+
@differentiable(wrt: (input, filter), vjp: _vjpConv2D)
398397
public func conv2D<Scalar: TensorFlowFloatingPoint>(
399-
_ x: Tensor<Scalar>,
398+
_ input: Tensor<Scalar>,
400399
filter: Tensor<Scalar>,
401400
strides: (Int, Int, Int, Int),
402401
padding: Padding
403402
) -> Tensor<Scalar> {
404403
return Raw.conv2D(
405-
x,
404+
input,
406405
filter: filter,
407406
strides: [Int32(strides.0), Int32(strides.1), Int32(strides.2), Int32(strides.3)],
408407
padding: padding.raw2,
409408
explicitPaddings: [])
410409
}
411410

412-
/// Computes a 3-D convolution using `self` as input, with the specified
413-
/// filter, strides, and padding.
411+
/// Computes a 3-D convolution with the specified input, filter, strides, and padding.
414412
///
415413
/// - Parameters:
416-
/// - x: The input.
414+
/// - input: The input.
417415
/// - filter: The convolution filter.
418416
/// - strides: The strides of the sliding filter for each dimension of the input.
419417
/// - padding: The padding for the operation.
420-
/// - Precondition: `self` must have rank 5.
418+
/// - Precondition: `input` must have rank `5`.
421419
/// - Precondition: `filter` must have rank 5.
422-
@differentiable(wrt: (x, filter), vjp: _vjpConv3D)
420+
@differentiable(wrt: (input, filter), vjp: _vjpConv3D)
423421
public func conv3D<Scalar: TensorFlowFloatingPoint>(
424-
_ x: Tensor<Scalar>,
422+
_ input: Tensor<Scalar>,
425423
filter: Tensor<Scalar>,
426424
strides: (Int, Int, Int, Int, Int),
427425
padding: Padding
428426
) -> Tensor<Scalar> {
429427
return Raw.conv3D(
430-
x,
428+
input,
431429
filter: filter,
432430
strides: [Int32(strides.0), Int32(strides.1), Int32(strides.2),
433431
Int32(strides.3), Int32(strides.4)],
@@ -438,19 +436,19 @@ public func conv3D<Scalar: TensorFlowFloatingPoint>(
438436
/// padding.
439437
///
440438
/// - Parameters:
441-
/// - x: The input.
439+
/// - input: The input.
442440
/// - filterSize: The dimensions of the pooling kernel.
443441
/// - strides: The strides of the sliding filter for each dimension of the input.
444442
/// - padding: The padding for the operation.
445-
@differentiable(wrt: x, vjp: _vjpMaxPool2D)
443+
@differentiable(wrt: input, vjp: _vjpMaxPool2D)
446444
public func maxPool2D<Scalar: TensorFlowFloatingPoint>(
447-
_ x: Tensor<Scalar>,
445+
_ input: Tensor<Scalar>,
448446
filterSize: (Int, Int, Int, Int),
449447
strides: (Int, Int, Int, Int),
450448
padding: Padding
451449
) -> Tensor<Scalar> {
452450
return Raw.maxPoolV2(
453-
x,
451+
input,
454452
ksize: Tensor<Int32>([Int32(filterSize.0), Int32(filterSize.1),
455453
Int32(filterSize.2), Int32(filterSize.3)]),
456454
strides: Tensor<Int32>([Int32(strides.0), Int32(strides.1),
@@ -462,19 +460,19 @@ public func maxPool2D<Scalar: TensorFlowFloatingPoint>(
462460
/// padding.
463461
///
464462
/// - Parameters:
465-
/// - x: The input.
463+
/// - input: The input.
466464
/// - filterSize: The dimensions of the pooling kernel.
467465
/// - strides: The strides of the sliding filter for each dimension of the input.
468466
/// - padding: The padding for the operation.
469-
@differentiable(wrt: x, vjp: _vjpMaxPool3D)
467+
@differentiable(wrt: input, vjp: _vjpMaxPool3D)
470468
public func maxPool3D<Scalar: TensorFlowFloatingPoint>(
471-
_ x: Tensor<Scalar>,
469+
_ input: Tensor<Scalar>,
472470
filterSize: (Int, Int, Int, Int, Int),
473471
strides: (Int, Int, Int, Int, Int),
474472
padding: Padding
475473
) -> Tensor<Scalar> {
476474
return Raw.maxPool3D(
477-
x,
475+
input,
478476
ksize: [Int32(filterSize.0), Int32(filterSize.1),
479477
Int32(filterSize.2), Int32(filterSize.3), Int32(filterSize.4)],
480478
strides: [Int32(strides.0), Int32(strides.1),
@@ -486,19 +484,19 @@ public func maxPool3D<Scalar: TensorFlowFloatingPoint>(
486484
/// and padding.
487485
///
488486
/// - Parameters:
489-
/// - x: The input.
487+
/// - input: The input.
490488
/// - filterSize: The dimensions of the pooling kernel.
491489
/// - strides: The strides of the sliding filter for each dimension of the input.
492490
/// - padding: The padding for the operation.
493-
@differentiable(wrt: x, vjp: _vjpAvgPool2D)
491+
@differentiable(wrt: input, vjp: _vjpAvgPool2D)
494492
public func avgPool2D<Scalar: TensorFlowFloatingPoint>(
495-
_ x: Tensor<Scalar>,
493+
_ input: Tensor<Scalar>,
496494
filterSize: (Int, Int, Int, Int),
497495
strides: (Int, Int, Int, Int),
498496
padding: Padding
499497
) -> Tensor<Scalar> {
500498
return Raw.avgPool(
501-
value: x,
499+
value: input,
502500
ksize: [Int32(filterSize.0), Int32(filterSize.1),
503501
Int32(filterSize.2), Int32(filterSize.3)],
504502
strides: [Int32(strides.0), Int32(strides.1), Int32(strides.2), Int32(strides.3)],
@@ -509,19 +507,19 @@ public func avgPool2D<Scalar: TensorFlowFloatingPoint>(
509507
/// and padding.
510508
///
511509
/// - Parameters:
512-
/// - x: The input.
510+
/// - input: The input.
513511
/// - filterSize: The dimensions of the pooling kernel.
514512
/// - strides: The strides of the sliding filter for each dimension of the input.
515513
/// - padding: The padding for the operation.
516-
@differentiable(wrt: x, vjp: _vjpAvgPool3D)
514+
@differentiable(wrt: input, vjp: _vjpAvgPool3D)
517515
public func avgPool3D<Scalar: TensorFlowFloatingPoint>(
518-
_ x: Tensor<Scalar>,
516+
_ input: Tensor<Scalar>,
519517
filterSize: (Int, Int, Int, Int, Int),
520518
strides: (Int, Int, Int, Int, Int),
521519
padding: Padding
522520
) -> Tensor<Scalar> {
523521
return Raw.avgPool3D(
524-
x,
522+
input,
525523
ksize: [Int32(filterSize.0), Int32(filterSize.1),
526524
Int32(filterSize.2), Int32(filterSize.3), Int32(filterSize.4)],
527525
strides: [Int32(strides.0), Int32(strides.1), Int32(strides.2), Int32(strides.3),

0 commit comments

Comments
 (0)