Tile

Description

Info

Parent class: Module

Derived classes: -

This module implements the operation of repeating the input tensor along a given axis a specified number of times.

Initializing

def __init__(self, axis, times, name=None):

Parameters

Parameter Allowed types Description Default
axis int Axis to fill -
times int Number of reiterations -
name str Layer name None

Explanations

-

Examples

Necessary imports.

>>> import numpy as np
>>> from PuzzleLib.Backend import gpuarray
>>> from PuzzleLib.Modules import Tile

Info

gpuarray is required to properly place the tensor in the GPU

>>> batchsize, maps, insize = 1, 1, 5
>>> ata = gpuarray.to_gpu(np.random.randint(0, 9, (batchsize, maps, insize)).astype(np.float32))
>>> data
[[[0. 3. 0. 6. 0.]]]
>>> axis, times = 0, 3
>>> tile = Tile(axis=axis, times=times)
>>> tile(data)
[[[0. 3. 0. 6. 0.]]

 [[0. 3. 0. 6. 0.]]

 [[0. 3. 0. 6. 0.]]]