deephyper.nas.node.VariableNode

deephyper.nas.node.VariableNode

class deephyper.nas.node.VariableNode(name='')[source]

Bases: deephyper.nas.node.OperationNode

This class represents a node of a graph where you have a set of possible operations. It means the agent will have to act to choose one of these operations.

>>> import tensorflow as tf
>>> from deephyper.nas.space.node import VariableNode
>>> vnode = VariableNode("VNode1")
>>> from deephyper.nas.space.op.op1d import Dense
>>> vnode.add_op(Dense(
... units=10,
... activation=tf.nn.relu))
>>> vnode.num_ops
1
>>> vnode.add_op(Dense(
... units=1000,
... activation=tf.nn.tanh))
>>> vnode.num_ops
2
>>> vnode.set_op(0)
>>> vnode.op.units
10
Parameters

name (str) – node name.

Methods

add_op

create_tensor

denormalize

Denormalize a normalized index to get an absolute indexes.

get_op

set_op

verify_operation

Attributes

id

num

num_ops

op

ops

denormalize(index)[source]

Denormalize a normalized index to get an absolute indexes. Useful when you want to compare the number of different search_spaces.

Parameters

indexes (float|int) – a normalized index.

Returns

An absolute indexes corresponding to the operation choosen with the relative index of index.

Return type

int