Axis

class webdnn.graph.axis.Axis(name=None)[source]

Class Axis represents the dimension of Variable. Axis is container and the represented dimension would be changed.

example

# a1 and a2 represent different dimensions
a1 = Axis()
a2 = Axis()

v1 = Variable([3, 5], Order([a1, a2))
>>> "<Variable shape=[3, 5] order=[?1, ?2]>"

# unify a1 and a2 (= let them represent the same dimension)
a1.unify(a2)

v2 = Variable([3, 5], Order([a1, a2))
>>> ValueError: "Axes are duplicated: [?1, ?1]"
Parameters:name (str, optional) – axis name
id

axis’s id, which is used to identify the which dimension the axis represents to

name

axis’s name

unify(other: webdnn.graph.axis.Axis)[source]

Unify two axes object. It means that they represents to same dimension. To unify two axes, they must not have different names.

Parameters:other (Axis) – the axis object which will be unified with this axis object.