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

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

 [[2. 2. 6. 1. 3.]]

 [[2. 2. 6. 1. 3.]]]