declearn.model.sklearn.NumpyVector
Bases: Vector
Vector subclass to store numpy.ndarray coefficients.
This Vector is designed to store a collection of named numpy arrays or scalars, enabling computations that are either applied to each and every coefficient, or imply two sets of aligned coefficients (i.e. two NumpyVector instances with similar coefficients specifications).
Use vector.coefs
to access the stored coefficients.
Notes
- A
NumpyVector
can be operated with either a scalar value, or anotherNumpyVector
that has similar specifications (same coefficient names, shapes and compatible dtypes). - Some other
Vector
classes might be made compatible withNumpyVector
; in that case, operating with aNumpyVector
will always result in a vector of the other type. This is notably the case withTensorflowVector
andTorchVector
. - There is currently no support for GPU-acceleration with the
NumpyVector
class, that only handles arrays and operations placed on a CPU device.
Source code in declearn/model/sklearn/_np_vec.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|