Options
All
  • Public
  • Public/Protected
  • All
Menu

deeplearn

Index

Enumerations

Classes

Interfaces

Type aliases

Functions

Type aliases

ConvInfo

ConvInfo: object

Information about the forward pass of a convolution/pooling operation. It includes input and output shape, strides, filter size and padding information.

Type declaration

FeedEntry

FeedEntry: object

FeedEntry associates a tensor with user-provided NDArray data.

Type declaration

FlatVector

FlatVector: boolean[] | number[] | TypedArray

RegularArray

RegularArray: T[] | T[][] | T[][][] | T[][][][]

ScopeResult

ScopeResultImmediate

ScopeResultImmediate: NDArray[] | NDArray | void

TypedArray

TypedArray: Float32Array | Int32Array | Uint8Array
license

Copyright 2017 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and

limitations under the License.

Functions

arraysEqual

assert

  • assert(expr: boolean, msg: string): void
  • Parameters

    • expr: boolean
    • msg: string

    Returns void

assertAndGetBroadcastedShape

  • assertAndGetBroadcastedShape(shapeA: number[], shapeB: number[]): number[]
  • Parameters

    • shapeA: number[]
    • shapeB: number[]

    Returns number[]

assertShapesMatch

  • assertShapesMatch(shapeA: number[], shapeB: number[], errorMessagePrefix?: string): void
  • Parameters

    • shapeA: number[]
    • shapeB: number[]
    • Default value errorMessagePrefix: string = ""

    Returns void

bindCanvasToFramebuffer

  • bindCanvasToFramebuffer(gl: WebGLRenderingContext): void

bindColorTextureToFramebuffer

  • bindColorTextureToFramebuffer(gl: WebGLRenderingContext, texture: WebGLTexture, framebuffer: WebGLFramebuffer): void
  • Parameters

    • gl: WebGLRenderingContext
    • texture: WebGLTexture
    • framebuffer: WebGLFramebuffer

    Returns void

bindTextureToProgramUniformSampler

  • bindTextureToProgramUniformSampler(gl: WebGLRenderingContext, program: WebGLProgram, texture: WebGLTexture, uniformSamplerLocation: WebGLUniformLocation, textureUnit: number): void
  • Parameters

    • gl: WebGLRenderingContext
    • program: WebGLProgram
    • texture: WebGLTexture
    • uniformSamplerLocation: WebGLUniformLocation
    • textureUnit: number

    Returns void

bindTextureUnit

  • bindTextureUnit(gl: WebGLRenderingContext, texture: WebGLTexture, textureUnit: number): void

bindVertexBufferToProgramAttribute

  • bindVertexBufferToProgramAttribute(gl: WebGLRenderingContext, program: WebGLProgram, attribute: string, buffer: WebGLBuffer, arrayEntriesPerItem: number, itemStrideInBytes: number, itemOffsetInBytes: number, attribLocations?: object): void
  • Parameters

    • gl: WebGLRenderingContext
    • program: WebGLProgram
    • attribute: string
    • buffer: WebGLBuffer
    • arrayEntriesPerItem: number
    • itemStrideInBytes: number
    • itemOffsetInBytes: number
    • Optional attribLocations: object
      • [name: string]: number

    Returns void

bindVertexProgramAttributeStreams

  • bindVertexProgramAttributeStreams(gl: WebGLRenderingContext, program: WebGLProgram, vertexBuffer: WebGLBuffer, attribLocations?: object): void
  • Parameters

    • gl: WebGLRenderingContext
    • program: WebGLProgram
    • vertexBuffer: WebGLBuffer
    • Optional attribLocations: object
      • [name: string]: number

    Returns void

callAndCheck

  • callAndCheck<T>(gl: WebGLRenderingContext, func: function): T
  • Type parameters

    • T

    Parameters

    • gl: WebGLRenderingContext
    • func: function
        • (): T
        • Returns T

    Returns T

checkWebGLError

  • checkWebGLError(gl: WebGLRenderingContext): void

clamp

  • clamp(min: number, x: number, max: number): number
  • Clamps a value to a specified range.

    Parameters

    • min: number
    • x: number
    • max: number

    Returns number

computeConvInfo

  • computeConvInfo(inShape: [number, number, number], filterHeight: number, filterWidth: number, outDepth: number, strideHeight: number, strideWidth: number, pad: "same" | "valid" | number): ConvInfo
  • Computes the information about a forward pass of a convolution/pooling operation.

    Parameters

    • inShape: [number, number, number]
    • filterHeight: number
    • filterWidth: number
    • outDepth: number
    • strideHeight: number
    • strideWidth: number
    • pad: "same" | "valid" | number

    Returns ConvInfo

computeDefaultPad

  • computeDefaultPad(inputShape: [number, number, number], fieldSize: number, stride: number): number
  • Parameters

    • inputShape: [number, number, number]
    • fieldSize: number
    • stride: number

    Returns number

computeDilatedRC

  • computeDilatedRC(rc: [number, number], origStride: number): [number, number]
  • Parameters

    • rc: [number, number]
    • origStride: number

    Returns [number, number]

computeOutputShape3D

  • computeOutputShape3D(inShape: [number, number, number], fieldSize: number, outDepth: number, stride: number, zeroPad?: number): [number, number, number]
  • deprecated

    Use conv_util.computeConvInfo instead.

    Parameters

    • inShape: [number, number, number]
    • fieldSize: number
    • outDepth: number
    • stride: number
    • Optional zeroPad: number

    Returns [number, number, number]

computeTexShapeFrom3D

  • computeTexShapeFrom3D(shapeRowColDepth: [number, number, number]): [number, number]
  • Parameters

    • shapeRowColDepth: [number, number, number]

    Returns [number, number]

computeWeightsShape4D

  • computeWeightsShape4D(inputDepth: number, outputDepth: number, filterHeight: number, filterWidth: number): [number, number, number, number]
  • Parameters

    • inputDepth: number
    • outputDepth: number
    • filterHeight: number
    • filterWidth: number

    Returns [number, number, number, number]

createColorMatrixTexture

  • createColorMatrixTexture(gl: WebGLRenderingContext, rows: number, columns: number): WebGLTexture

createFragmentShader

  • createFragmentShader(gl: WebGLRenderingContext, fragmentShaderSource: string): WebGLShader

createFramebuffer

  • createFramebuffer(gl: WebGLRenderingContext): WebGLFramebuffer

createIndexBuffer

  • createIndexBuffer(gl: WebGLRenderingContext): WebGLBuffer

createMatrixTexture

  • createMatrixTexture(gl: WebGLRenderingContext, rows: number, columns: number): WebGLTexture

createPackedMatrixTexture

  • createPackedMatrixTexture(gl: WebGLRenderingContext, rows: number, columns: number): WebGLTexture

createProgram

  • createProgram(gl: WebGLRenderingContext): WebGLProgram

createShuffledIndices

  • createShuffledIndices(n: number): Uint32Array
  • Parameters

    • n: number

    Returns Uint32Array

createStaticIndexBuffer

  • createStaticIndexBuffer(gl: WebGLRenderingContext, data: Uint16Array): WebGLBuffer

createStaticVertexBuffer

  • createStaticVertexBuffer(gl: WebGLRenderingContext, data: Float32Array): WebGLBuffer

createTexture

  • createTexture(gl: WebGLRenderingContext): WebGLTexture

createVertexBuffer

  • createVertexBuffer(gl: WebGLRenderingContext): WebGLBuffer

createVertexShader

  • createVertexShader(gl: WebGLRenderingContext, vertexShaderSource: string): WebGLShader

createWebGLContext

  • createWebGLContext(canvas?: HTMLCanvasElement): WebGLRenderingContext

createWebGLRenderingContext

createWebGLRenderingContextFromCanvas

  • createWebGLRenderingContextFromCanvas(canvas: HTMLCanvasElement, attributes: WebGLContextAttributes): WebGLRenderingContext

distSquared

downloadMatrixFromOutputTexture

  • downloadMatrixFromOutputTexture(gl: WebGLRenderingContext, rows: number, columns: number): Float32Array

downloadMatrixFromPackedOutputTexture

  • downloadMatrixFromPackedOutputTexture(gl: WebGLRenderingContext, rows: number, columns: number): Float32Array

downloadMatrixFromRGBAColorTexture

  • downloadMatrixFromRGBAColorTexture(gl: WebGLRenderingContext, rows: number, columns: number, channels: number): Float32Array
  • Parameters

    • gl: WebGLRenderingContext
    • rows: number
    • columns: number
    • channels: number

    Returns Float32Array

enableDebugWebGLErrorChecking

  • enableDebugWebGLErrorChecking(enabled: boolean): void

flatten

  • flatten(arr: number | boolean | RegularArray<number> | RegularArray<boolean>, ret?: Array<number | boolean>): Array<number | boolean>
  • Parameters

    Returns Array<number | boolean>

getBroadcastedDims

  • getBroadcastedDims(inShape: number[], outShape: number[]): number[]
  • Parameters

    • inShape: number[]
    • outShape: number[]

    Returns number[]

getChannelsPerTexture

  • getChannelsPerTexture(): number

getExtensionOrThrow

  • getExtensionOrThrow(gl: WebGLRenderingContext, extensionName: string): __type

getFramebufferErrorMessage

  • getFramebufferErrorMessage(gl: WebGLRenderingContext, status: number): string

getProgramUniformLocationOrThrow

  • getProgramUniformLocationOrThrow(gl: WebGLRenderingContext, program: WebGLProgram, uniformName: string): WebGLUniformLocation
  • Parameters

    • gl: WebGLRenderingContext
    • program: WebGLProgram
    • uniformName: string

    Returns WebGLUniformLocation

getQueryParams

  • getQueryParams(queryString: string): object
  • Parameters

    • queryString: string

    Returns object

    • [key: string]: string

getRenderRGBShader

  • getRenderRGBShader(gpgpu: GPGPUContext, destinationWidth: number): WebGLProgram

getTextureShapeFromLogicalShape

  • getTextureShapeFromLogicalShape(gl: WebGLRenderingContext, logShape: number[], preferredTexShape?: [number, number]): [number, number]
  • Parameters

    • gl: WebGLRenderingContext
    • logShape: number[]
    • Optional preferredTexShape: [number, number]

    Returns [number, number]

getWebGLContextAttributes

  • getWebGLContextAttributes(): WebGLContextAttributes

getWebGLErrorMessage

  • getWebGLErrorMessage(gl: WebGLRenderingContext, status: number): string

inferFromImplicitShape

  • inferFromImplicitShape(shape: number[], size: number): number[]
  • Given the full size of the array and a shape that may contain -1 as the implicit dimension, returns the inferred shape where -1 is replaced. E.g. For shape=[2, -1, 3] and size=24, it will return [2, 4, 3].

    Parameters

    • shape: number[]

      The shape, which may contain -1 in some dimension.

    • size: number

      The full size (number of elements) of the array.

    Returns number[]

    The inferred shape where -1 is replaced with the inferred size.

inferShape

isInt

  • isInt(a: number): boolean
  • Parameters

    • a: number

    Returns boolean

isScalarShape

  • isScalarShape(shape: number[]): boolean
  • Parameters

    • shape: number[]

    Returns boolean

linkProgram

  • linkProgram(gl: WebGLRenderingContext, program: WebGLProgram): void

queryMaxTextureSize

  • queryMaxTextureSize(gl: WebGLRenderingContext): number

randGauss

  • randGauss(mean?: number, stdDev?: number, truncated?: boolean): number
  • Samples from a gaussian distribution.

    Parameters

    • Default value mean: number = 0

      The mean. Default is 0.

    • Default value stdDev: number = 1

      The standard deviation. Default is 1.

    • Default value truncated: boolean = false

    Returns number

randUniform

  • randUniform(a: number, b: number): number
  • Returns a sample from a uniform [a, b] distribution.

    Parameters

    • a: number
    • b: number

    Returns number

renderToCanvas

  • renderToCanvas(gpgpu: GPGPUContext, renderShader: WebGLProgram, sourceTex: WebGLTexture): void

renderToFramebuffer

  • renderToFramebuffer(gpgpu: GPGPUContext, renderShader: WebGLProgram, sourceTex: WebGLTexture): void

repeatedTry

  • repeatedTry(checkFn: function, delayFn?: (Anonymous function), maxCounter?: number): Promise<void>
  • Parameters

    • checkFn: function
        • (): boolean
        • Returns boolean

    • Default value delayFn: (Anonymous function) = (counter: number) => 0
    • Optional maxCounter: number

    Returns Promise<void>

rightPad

  • rightPad(a: string, size: number): string
  • Parameters

    • a: string
    • size: number

    Returns string

shuffle

  • shuffle(array: any[] | Uint32Array | Int32Array | Float32Array): void
  • Shuffles the array using Fisher-Yates algorithm.

    Parameters

    • array: any[] | Uint32Array | Int32Array | Float32Array

    Returns void

sizeFromShape

  • sizeFromShape(shape: number[]): number
  • Parameters

    • shape: number[]

    Returns number

sizeToSquarishShape

  • sizeToSquarishShape(size: number): [number, number]
  • Parameters

    • size: number

    Returns [number, number]

tanh

  • tanh(x: number): number
  • Parameters

    • x: number

    Returns number

unbindColorTextureFromFramebuffer

  • unbindColorTextureFromFramebuffer(gl: WebGLRenderingContext, framebuffer: WebGLFramebuffer): void

unbindTextureUnit

  • unbindTextureUnit(gl: WebGLRenderingContext, textureUnit: number): void

uploadMatrixToPackedTexture

  • uploadMatrixToPackedTexture(gl: WebGLRenderingContext, texture: WebGLTexture, rows: number, columns: number, matrix: Float32Array): void
  • Parameters

    • gl: WebGLRenderingContext
    • texture: WebGLTexture
    • rows: number
    • columns: number
    • matrix: Float32Array

    Returns void

uploadMatrixToTexture

  • uploadMatrixToTexture(gl: WebGLRenderingContext, texture: WebGLTexture, rows: number, columns: number, matrix: Float32Array, numChannels: number): void
  • Parameters

    • gl: WebGLRenderingContext
    • texture: WebGLTexture
    • rows: number
    • columns: number
    • matrix: Float32Array
    • numChannels: number

    Returns void

uploadPixelDataToTexture

  • uploadPixelDataToTexture(gl: WebGLRenderingContext, texture: WebGLTexture, pixels: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void
  • Parameters

    • gl: WebGLRenderingContext
    • texture: WebGLTexture
    • pixels: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement

    Returns void

validateFramebuffer

  • validateFramebuffer(gl: WebGLRenderingContext): void

validateProgram

  • validateProgram(gl: WebGLRenderingContext, program: WebGLProgram): void

validateTextureSize

  • validateTextureSize(gl: WebGLRenderingContext, width: number, height: number): void

Generated using TypeDoc