Conv1D

class Conv1D(filters: Int, kernelLength: Int, strides: IntArray, dilations: IntArray, activation: Activations, kernelInitializer: Initializer, biasInitializer: Initializer, kernelRegularizer: Regularizer?, biasRegularizer: Regularizer?, activityRegularizer: Regularizer?, padding: ConvPadding, useBias: Boolean, name: String) : AbstractConv, TrainableLayer

1D convolution layer (e.g. convolution over audio data).

This layer creates a convolution kernel that is convolved (actually cross-correlated) with the layer input to produce a tensor of outputs. Finally, the activation is applied to the outputs as well.

It expects input data of size (N, L, C) where

N - batch size
L - length of signal sequence
C - number of channels

Since

0.3

Constructors

Conv1D
Link copied to clipboard
fun Conv1D(filters: Int = 32, kernelLength: Int = 3, strides: Int = 1, dilations: Int = 1, activation: Activations = Activations.Relu, kernelInitializer: Initializer = HeNormal(), biasInitializer: Initializer = HeUniform(), kernelRegularizer: Regularizer? = null, biasRegularizer: Regularizer? = null, activityRegularizer: Regularizer? = null, padding: ConvPadding = ConvPadding.SAME, useBias: Boolean = true, name: String = "")
Conv1D
Link copied to clipboard
fun Conv1D(filters: Int = 32, kernelLength: Int = 3, strides: IntArray = intArrayOf(1, 1, 1), dilations: IntArray = intArrayOf(1, 1, 1), activation: Activations = Activations.Relu, kernelInitializer: Initializer = HeNormal(), biasInitializer: Initializer = HeUniform(), kernelRegularizer: Regularizer? = null, biasRegularizer: Regularizer? = null, activityRegularizer: Regularizer? = null, padding: ConvPadding = ConvPadding.SAME, useBias: Boolean = true, name: String = "")

Creates Conv1D object.

Functions

build
Link copied to clipboard
open override fun build(tf: Ops, inputShape: Shape)

Extend this function to define variables in layer.

buildFromInboundLayers
Link copied to clipboard
fun buildFromInboundLayers(tf: Ops)

Extend this function to define variables in layer.

computeOutputShape
Link copied to clipboard
open override fun computeOutputShape(inputShape: Shape): Shape

Computes output shape, based on inputShape and Layer type.

computeOutputShapeFromInboundLayers
Link copied to clipboard
open fun computeOutputShapeFromInboundLayers(): TensorShape

Computes output shape, based on input shapes of inbound layers.

forward
Link copied to clipboard
open override fun forward(tf: Ops, input: Operand<Float>, isTraining: Operand<Boolean>, numberOfLosses: Operand<Float>?): Operand<Float>

Builds main layer input transformation with tf. Depends on Layer type.

open fun forward(tf: Ops, input: List<Operand<Float>>, isTraining: Operand<Boolean>, numberOfLosses: Operand<Float>?): Operand<Float>

Builds main layer input transformation with tf. Depends on Layer type.

invoke
Link copied to clipboard
operator fun invoke(vararg layers: Layer): Layer

Important part of functional API. It takes layers as input and saves them to the inboundLayers of the given layer.

toString
Link copied to clipboard
open override fun toString(): String

Properties

activation
Link copied to clipboard
open override val activation: Activations

Activation function.

activityRegularizer
Link copied to clipboard
open override val activityRegularizer: Regularizer? = null

Regularizer function applied to the output of the layer (its "activation").

biasInitializer
Link copied to clipboard
open override val biasInitializer: Initializer

An initializer for the bias vector.

biasRegularizer
Link copied to clipboard
open override val biasRegularizer: Regularizer? = null

Regularizer function applied to the bias vector.

dilations
Link copied to clipboard
open override val dilations: IntArray

Three numbers specifying the dilation rate to use for dilated convolution sequence dimensions of input tensor.

filters
Link copied to clipboard
open override val filters: Int = 32

The dimensionality of the output space (i.e. the number of filters in the convolution).

hasActivation
Link copied to clipboard
open override val hasActivation: Boolean

Returns True, if layer has internal activation function.

inboundLayers
Link copied to clipboard
var inboundLayers: MutableList<Layer>

Returns inbound layers.

isTrainable
Link copied to clipboard
open override var isTrainable: Boolean = true

True, if layer's weights could be changed during training. If false, layer's weights are frozen and could not be changed during training.

kernelInitializer
Link copied to clipboard
open override val kernelInitializer: Initializer

An initializer for the convolution kernel

kernelLength
Link copied to clipboard
val kernelLength: Int = 3

Long number, specifying the width of the 1D convolution window.

kernelRegularizer
Link copied to clipboard
open override val kernelRegularizer: Regularizer? = null

Regularizer function applied to the kernel weights matrix.

name
Link copied to clipboard
var name: String

Layer name. A new name is generated during model compilation when provided name is empty.

outboundLayers
Link copied to clipboard
var outboundLayers: MutableList<Layer>

Returns outbound layers.

outputShape
Link copied to clipboard
lateinit var outputShape: TensorShape

Output data tensor shape.

padding
Link copied to clipboard
open override val padding: ConvPadding

The padding method, either 'valid' or 'same' or 'full'.

paramCount
Link copied to clipboard
open val paramCount: Int

Number of parameters in this layer.

parentModel
Link copied to clipboard
var parentModel: GraphTrainableModel? = null

Model where this layer is used.

strides
Link copied to clipboard
open override val strides: IntArray

Three numbers specifying the strides of the pooling operation for each dimension of input tensor. NOTE: Specifying stride value != 1 is incompatible with specifying dilation value != 1.

useBias
Link copied to clipboard
open override val useBias: Boolean = true

If true the layer uses a bias vector.

variables
Link copied to clipboard
open override val variables: List<KVariable>

Variables used in this layer.