Cytnx v1.0.0
Loading...
Searching...
No Matches
Generator.hpp
Go to the documentation of this file.
1#ifndef CYTNX_GENERATOR_H_
2#define CYTNX_GENERATOR_H_
3
4#include "Type.hpp"
5#include "Device.hpp"
6#include "cytnx_error.hpp"
7#include "Tensor.hpp"
8#include <vector>
9#include <initializer_list>
10
11#ifdef BACKEND_TORCH
12#else
13namespace cytnx {
14
16
28 Tensor zeros(const cytnx_uint64 &Nelem, const unsigned int &dtype = Type.Double,
29 const int &device = Device.cpu);
42 Tensor zeros(const std::vector<cytnx_uint64> &Nelem, const unsigned int &dtype = Type.Double,
43 const int &device = Device.cpu);
45
59 Tensor identity(const cytnx_uint64 &Dim, const unsigned int &dtype = Type.Double,
60 const int &device = Device.cpu);
61
78 Tensor eye(const cytnx_uint64 &Dim, const unsigned int &dtype = Type.Double,
79 const int &device = Device.cpu);
80
82
94 Tensor ones(const cytnx_uint64 &Nelem, const unsigned int &dtype = Type.Double,
95 const int &device = Device.cpu);
108 Tensor ones(const std::vector<cytnx_uint64> &Nelem, const unsigned int &dtype = Type.Double,
109 const int &device = Device.cpu);
111
113
120 Tensor arange(const cytnx_int64 &Nelem);
134 Tensor arange(const cytnx_double &start, const cytnx_double &end, const cytnx_double &step = 1,
135 const unsigned int &dtype = Type.Double, const int &device = Device.cpu);
137
138 Tensor linspace(const cytnx_double &start, const cytnx_double &end, const cytnx_uint64 &Nelem,
139 const bool &endpoint = true, const unsigned int &dtype = Type.Double,
140 const int &device = Device.cpu);
141
142 // Tensor rand(const std::vector<cytnx_uint64> &size);
143 // Tensor randn(const std::vector<cytnx_uint64> &size);
144 // Tensor normal(const cytnx_double &mean, cytnx_double &std);
145
146} // namespace cytnx
147
148#endif // BACKEND_TORCH
149
150#endif // CYTNX_GENERATOR_H_
constexpr Type_class Type
data type
Definition Type.hpp:426
an tensor (multi-dimensional array)
Definition Tensor.hpp:41
Definition Accessor.hpp:12
Device_class Device
data on which devices.
Tensor linspace(const cytnx_double &start, const cytnx_double &end, const cytnx_uint64 &Nelem, const bool &endpoint=true, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
Tensor arange(const cytnx_int64 &Nelem)
Create a rank-1 Tensor with incremental unsigned integer elements in the range [0,...
Tensor ones(const cytnx_uint64 &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
Create a rank-1 Tensor with all elements initialized to one.
Tensor zeros(const cytnx_uint64 &Nelem, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
Create a rank-1 Tensor with all elements initialized to zero.
Tensor identity(const cytnx_uint64 &Dim, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
Create a square rank-2 Tensor with the diagonal initialized to one and all other elements set to zero...
Tensor eye(const cytnx_uint64 &Dim, const unsigned int &dtype=Type.Double, const int &device=Device.cpu)
Create a square rank-2 Tensor with the diagonal initialized to one and all other elements set to zero...