Initializers
Contents
Initializers#
empty#
- tensorkrowch.empty(shape, param_node=False, *args, **kwargs)[source]#
- Returns - Nodeor- ParamNodewithout tensor.- Parameters:
- shape (list[int], tuple[int] or torch.Size) – Node’s shape, that is, the shape of its tensor. 
- param_node (bool) – Boolean indicating whether the node should be a - ParamNode(- True) or a- Node(- False).
- args – Arguments to initialize an - AbstractNode.
- kwargs – Keyword arguments to initialize an - AbstractNode.
 
- Return type:
 
zeros#
- tensorkrowch.zeros(shape, param_node=False, *args, **kwargs)[source]#
- Returns - Nodeor- ParamNodefilled with zeros.- Parameters:
- shape (list[int], tuple[int] or torch.Size) – Node’s shape, that is, the shape of its tensor. 
- param_node (bool) – Boolean indicating whether the node should be a - ParamNode(- True) or a- Node(- False).
- args – Arguments to initialize an - AbstractNode.
- kwargs – Keyword arguments to initialize an - AbstractNode.
 
- Return type:
 
ones#
- tensorkrowch.ones(shape, param_node=False, *args, **kwargs)[source]#
- Returns - Nodeor- ParamNodefilled with ones.- Parameters:
- shape (list[int], tuple[int] or torch.Size) – Node’s shape, that is, the shape of its tensor. 
- param_node (bool) – Boolean indicating whether the node should be a - ParamNode(- True) or a- Node(- False).
- args – Arguments to initialize an - AbstractNode.
- kwargs – Keyword arguments to initialize an - AbstractNode.
 
- Return type:
 
copy#
- tensorkrowch.copy(shape, param_node=False, *args, **kwargs)[source]#
- Returns - Nodeor- ParamNodewith a copy tensor, that is, a tensor filled with zeros except in the diagonal (elements \(T_{i_1 \ldots i_n}\) with \(i_1 = \ldots = i_n\)), which is filled with ones.- Parameters:
- shape (list[int], tuple[int] or torch.Size) – Node’s shape, that is, the shape of its tensor. 
- param_node (bool) – Boolean indicating whether the node should be a - ParamNode(- True) or a- Node(- False).
- args – Arguments to initialize an - AbstractNode.
- kwargs – Keyword arguments to initialize an - AbstractNode.
 
- Return type:
 
rand#
- tensorkrowch.rand(shape, param_node=False, *args, **kwargs)[source]#
- Returns - Nodeor- ParamNodefilled with elements drawn from a uniform distribution \(U(low, high)\).- Parameters:
- shape (list[int], tuple[int] or torch.Size) – Node’s shape, that is, the shape of its tensor. 
- param_node (bool) – Boolean indicating whether the node should be a - ParamNode(- True) or a- Node(- False).
- args – Arguments to initialize an - AbstractNode.
- kwargs – Keyword arguments to initialize an - AbstractNode.
 
- Return type:
 
randn#
- tensorkrowch.randn(shape, param_node=False, *args, **kwargs)[source]#
- Returns - Nodeor- ParamNodefilled with elements drawn from a normal distribution \(N(mean, std)\).- Parameters:
- shape (list[int], tuple[int] or torch.Size) – Node’s shape, that is, the shape of its tensor. 
- param_node (bool) – Boolean indicating whether the node should be a - ParamNode(- True) or a- Node(- False).
- args – Arguments to initialize an - AbstractNode.
- kwargs – Keyword arguments to initialize an - AbstractNode.
 
- Return type: