Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Sources/DeepLearning/Layer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1009,12 +1009,32 @@ public struct AvgPool2D<Scalar: TensorFlowFloatingPoint>: Layer {
}
}


/// A global average pooling layer for temporal data.
@_fixed_layout
public struct GlobalAveragePooling1D<Scalar: TensorFlowFloatingPoint>: Layer {
/// Creates a global average pooling layer in 1 dimension

@rxwei rxwei Apr 1, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Creates a global average pooling layer in 1 dimension
/// Creates a global average pooling layer.
  • Please end sentences with a period.
  • Remove "in 1 dimension" to be consistent with the doc comment on the type declaration.

public init() {}

/// Returns the output obtained from applying the layer to the given input.
///
/// - Parameters:
/// - input: The input to the layer.
/// - context: The contextual information for the layer application, e.g. the current learning
/// phase.
/// - Returns: The output
@differentiable
public func applied(to input: Tensor<Scalar>, in _: Context) -> Tensor<Scalar> {
return input.mean(alongAxes: axis)
Comment thread
Shashi456 marked this conversation as resolved.
Outdated
}
}

/// A global average pooling layer for spatial data.
@_fixed_layout
public struct GlobalAveragePooling2D<Scalar: TensorFlowFloatingPoint>: Layer {
/// Creates a global average pooling layer.
public init() {}

/// Returns the output obtained from applying the layer to the given input.
///
/// - Parameters:
Expand Down