TensorSpace.js
Getting Start
Basic Concepts
Model Preprocessing
Models
Layers
Merge Function
Activation1d
1d Active function layer. The shape is not change through Activation1d layer, but values will change.
Constructor
〔Method 1〕Use activation
TSP.layers.Activation1d( { activation : String } );
〔Method 2〕Use shape
TSP.layers.Activation1d( { shape : [ Int ] } );
Fig. 1 - Activation1d layer collapse and expand
Arguments

Name

Tag

Type

Instruction

Usage Notes and Examples

activation

📦

String Name of active function Options: softmax sigmoid tanh ReLU LReLU ELU

paging

🎨🔧

Bool Enable Pagination, more about paging Since the long 1D layer could make the model hard to visualize, we use paging. true Enable; false [Default] Disable

segmentLength

🎨⚙️

Int Amount of nodes in one page, only take effect when "paging" is enabled 200[Default] 200 nodes in each page

segmentIndex

🎨⚙️

Int The initial start index of first page, only take effect when "paging" is enabled 0[Default]

overview

🎨⚙️

Bool Look layer Text from different angle, more about overview false[Default]

name

🔧

String Name of this layer. Highly recommend to arrange to make code more readable. name: "layerName"

color

⚙️🎨

color format Color of layer Activation1d default is #fc5c9c

closeButton

⚙️🎨

Dict Close button appearance control dict, more about close button

display : Boolean. true[default] Show button, false Hide button

ratio : Int. Times to normal size, default is 1

For example, 2 means twice the normal size

initStatus

⚙️️🎦

String Layer status at beginning. Open or Close close[default] : Closed at beginning

animation-
TimeRatio

⚙️🎦

Int The speed of open and close animation Integer for multiple of speed. For example, 2 for 2 times of basic speed.
Properties
.inputShape : Int[]
filter_center_focusFor example inputShape = [ 32 ] represents length of input vector is 32.
filter_center_focusAfter model.init() data is available, otherwise is undefined.
.outputShape : Int[]
filter_center_focusThe shape of output tensor is 1-dimensional. 1️⃣
filter_center_focusFor example outputShape = [ 32 ] represents length of output vector is 32.
filter_center_focusAfter model.init() data is available, otherwise is undefined.
.neuralValue : Int[]
filter_center_focusThe intermediate raw data after this layer.
filter_center_focusAfter load and model.predict() data is available, otherwise is undefined.
.name : String
filter_center_focusThe custom name for this layer.
filter_center_focusOnce created, you can get it.
.layerType : String
filter_center_focusType of this layer, return a constant: string Activation1d.
filter_center_focusOnce created, you can get it.
Method
filter_center_focusThis method only used in Functional Model (Non-sequential, Graph structure).
filter_center_focusLink this layer to layer which is the previous layer.
filter_center_focusTo crete a link between this layer and the previous layer. You don't need to use this method specifically to create links in Sequential Model; Instead, you can simply add layers along the lines of Keras or TensorFlow.js build the model syntax.
let inputLayer = new TSP.layers.Input1d( {

    shape: [28]

} );

let activationLayer = new TSP.layers.Activation1d( {

    activation: "softmax"

} );

activationLayer.apply( inputLayer );
filter_center_focusClick on the layer directly to open it by interacting directly with the object in the 3D scene.
filter_center_focusIn code, calling the method to open it.
let activationLayer = new TSP.layers.Activation1d( {

    // configure some parameters for Activation1d.

} );

model.add( activationLayer );

// ... add more layers for model.

model.init();

// Call openLayer API to open layer.

activationLayer.openLayer();
filter_center_focusTo close by interacting directly with objects in a 3D scene by clicking the close button.
filter_center_focus In code, calling the method to close it.
let activationLayer = new TSP.layers.Activation1d( {

    // configure some parameters for Activation1d.

} );

model.add( activationLayer );

// ... add more layers for model.

model.init();

// If this layer already opened, call closeLayer API to close layer.

activationLayer.closeLayer();
Example
filter_center_focus Declare an instance of Activation1d to facilitate reuse
let activationLayer = new TSP.layers.Activation1d( {

    activation: "softmax",
    name: "Activation1d1",
    initStatus: "open"

} );

model.add( activationLayer );
filter_center_focusAdd Activation1d directly
model.add( new TSP.layers.Activation1d( {

    activation: "softmax",
    name: "Activation1d2"

} ) );
Use Case
When you add activation layer with Keras | TensorFlow | tfjs in your model the corresponding API is activation1d in TensorSpace.
Framework Documentation
Keras keras.activations.softmax(x, axis=-1)
TensorFlow tf.nn.log_softmax( logits, axis=None, name=None, dim=None )
TensorFlow.js tf.layers.activation({activation: 'relu6'})
Tag Lookup
Tag Icon Meaning Instruction
⭐️ Required Must be provided, cannot be empty. Meanwhile constructor works properly if this arguments provided. Control arguments use default value.
🔧 Suggest Recommended for giving. The API can work without them.
⚙️ Optional As an auxiliary adjustment parameter when used, selectively added according to the specific situation The parameters here have no effect on the structure of the layer (3D visualized form).
📦 Model Configure the properties of the Layer. It changes the output shape.
🎨 Style Override the properties in TSP.model (model configuration)
🎦 Animation Override the properties in TSP.model (model configuration)
Source Code
tensorspace/src/layer/intermediate/Activation1d.js