Interpolation Layer

Create an Interpolation relation in the neural network model.

This block performs linear interpolation of an input tensor x given two vectors of points.

[1]:
# uncomment the command below to install the nnodely package
#!pip install nnodely

from nnodely import *
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-- nnodely_v1.5.0 --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Basic Usage

Create an interpolation layer passing two vectors of points. the two vectors must have the same shape

[2]:
x = Input('x')
interpolation = Interpolation(x_points=[1.0, 2.0, 3.0, 4.0],y_points=[1.0, 4.0, 9.0, 16.0])(x.last())
out = Output('out',interpolation)

Linear Interpolation

Create a linear interpolation layer passing two vectors of points.

!! Note that the points do not necessarily need to be ordered

[3]:
y = Input('y')
interpolation = Interpolation(x_points=[1.0, 4.0, 3.0, 2.0],y_points=[1.0, 16.0, 9.0, 4.0], mode='linear')(y.last())
out = Output('out',interpolation)
[check_names] The name 'out' is already in defined as NeuObj but it is overwritten.