Debian Codegraph @

docs/api/tensor.md

raw
1 # PyTorchTensor
2 ```python
3 PyTorchTensor(self, raw:'torch.Tensor')
4 ```
5
6 # TensorFlowTensor
7 ```python
8 TensorFlowTensor(self, raw:'tf.Tensor')
9 ```
10
11 # JAXTensor
12 ```python
13 JAXTensor(self, raw:'np.ndarray')
14 ```
15
16 # NumPyTensor
17 ```python
18 NumPyTensor(self, raw:'np.ndarray')
19 ```
20
21 # Tensor
22 ```python
23 Tensor(self, raw:Any)
24 ```
25 Base class defining the common interface of all EagerPy Tensors
26 ## sign
27 ```python
28 Tensor.sign(self:~TensorType) -> ~TensorType
29 ```
30
31 ## sqrt
32 ```python
33 Tensor.sqrt(self:~TensorType) -> ~TensorType
34 ```
35
36 ## tanh
37 ```python
38 Tensor.tanh(self:~TensorType) -> ~TensorType
39 ```
40
41 ## float32
42 ```python
43 Tensor.float32(self:~TensorType) -> ~TensorType
44 ```
45
46 ## where
47 ```python
48 Tensor.where(self:~TensorType, x:Union[_ForwardRef('Tensor'), int, float], y:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
49 ```
50
51 ## matmul
52 ```python
53 Tensor.matmul(self:~TensorType, other:~TensorType) -> ~TensorType
54 ```
55
56 ## ndim
57
58 ## numpy
59 ```python
60 Tensor.numpy(self:~TensorType) -> Any
61 ```
62
63 ## item
64 ```python
65 Tensor.item(self:~TensorType) -> Union[int, float]
66 ```
67
68 ## shape
69
70 ## reshape
71 ```python
72 Tensor.reshape(self:~TensorType, shape:Union[Tuple[int, ...], int]) -> ~TensorType
73 ```
74
75 ## take_along_axis
76 ```python
77 Tensor.take_along_axis(self:~TensorType, index:~TensorType, axis:int) -> ~TensorType
78 ```
79
80 ## astype
81 ```python
82 Tensor.astype(self:~TensorType, dtype:Any) -> ~TensorType
83 ```
84
85 ## clip
86 ```python
87 Tensor.clip(self:~TensorType, min_:float, max_:float) -> ~TensorType
88 ```
89
90 ## square
91 ```python
92 Tensor.square(self:~TensorType) -> ~TensorType
93 ```
94
95 ## arctanh
96 ```python
97 Tensor.arctanh(self:~TensorType) -> ~TensorType
98 ```
99
100 ## sum
101 ```python
102 Tensor.sum(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
103 ```
104
105 ## prod
106 ```python
107 Tensor.prod(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
108 ```
109
110 ## mean
111 ```python
112 Tensor.mean(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
113 ```
114
115 ## min
116 ```python
117 Tensor.min(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
118 ```
119
120 ## max
121 ```python
122 Tensor.max(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
123 ```
124
125 ## minimum
126 ```python
127 Tensor.minimum(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
128 ```
129
130 ## maximum
131 ```python
132 Tensor.maximum(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
133 ```
134
135 ## argmin
136 ```python
137 Tensor.argmin(self:~TensorType, axis:Union[int, NoneType]=None) -> ~TensorType
138 ```
139
140 ## argmax
141 ```python
142 Tensor.argmax(self:~TensorType, axis:Union[int, NoneType]=None) -> ~TensorType
143 ```
144
145 ## argsort
146 ```python
147 Tensor.argsort(self:~TensorType, axis:int=-1) -> ~TensorType
148 ```
149
150 ## topk
151 ```python
152 Tensor.topk(self:~TensorType, k:int, sorted:bool=True) -> Tuple[~TensorType, ~TensorType]
153 ```
154
155 ## uniform
156 ```python
157 Tensor.uniform(self:~TensorType, shape:Union[Tuple[int, ...], int], low:float=0.0, high:float=1.0) -> ~TensorType
158 ```
159
160 ## normal
161 ```python
162 Tensor.normal(self:~TensorType, shape:Union[Tuple[int, ...], int], mean:float=0.0, stddev:float=1.0) -> ~TensorType
163 ```
164
165 ## ones
166 ```python
167 Tensor.ones(self:~TensorType, shape:Union[Tuple[int, ...], int]) -> ~TensorType
168 ```
169
170 ## zeros
171 ```python
172 Tensor.zeros(self:~TensorType, shape:Union[Tuple[int, ...], int]) -> ~TensorType
173 ```
174
175 ## ones_like
176 ```python
177 Tensor.ones_like(self:~TensorType) -> ~TensorType
178 ```
179
180 ## zeros_like
181 ```python
182 Tensor.zeros_like(self:~TensorType) -> ~TensorType
183 ```
184
185 ## full_like
186 ```python
187 Tensor.full_like(self:~TensorType, fill_value:float) -> ~TensorType
188 ```
189
190 ## onehot_like
191 ```python
192 Tensor.onehot_like(self:~TensorType, indices:~TensorType, *, value:float=1) -> ~TensorType
193 ```
194
195 ## from_numpy
196 ```python
197 Tensor.from_numpy(self:~TensorType, a:Any) -> ~TensorType
198 ```
199
200 ## transpose
201 ```python
202 Tensor.transpose(self:~TensorType, axes:Union[Tuple[int, ...], NoneType]=None) -> ~TensorType
203 ```
204
205 ## bool
206 ```python
207 Tensor.bool(self:~TensorType) -> ~TensorType
208 ```
209
210 ## all
211 ```python
212 Tensor.all(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
213 ```
214
215 ## any
216 ```python
217 Tensor.any(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
218 ```
219
220 ## logical_and
221 ```python
222 Tensor.logical_and(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
223 ```
224
225 ## logical_or
226 ```python
227 Tensor.logical_or(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
228 ```
229
230 ## logical_not
231 ```python
232 Tensor.logical_not(self:~TensorType) -> ~TensorType
233 ```
234
235 ## exp
236 ```python
237 Tensor.exp(self:~TensorType) -> ~TensorType
238 ```
239
240 ## log
241 ```python
242 Tensor.log(self:~TensorType) -> ~TensorType
243 ```
244
245 ## log2
246 ```python
247 Tensor.log2(self:~TensorType) -> ~TensorType
248 ```
249
250 ## log10
251 ```python
252 Tensor.log10(self:~TensorType) -> ~TensorType
253 ```
254
255 ## log1p
256 ```python
257 Tensor.log1p(self:~TensorType) -> ~TensorType
258 ```
259
260 ## tile
261 ```python
262 Tensor.tile(self:~TensorType, multiples:Tuple[int, ...]) -> ~TensorType
263 ```
264
265 ## softmax
266 ```python
267 Tensor.softmax(self:~TensorType, axis:int=-1) -> ~TensorType
268 ```
269
270 ## log_softmax
271 ```python
272 Tensor.log_softmax(self:~TensorType, axis:int=-1) -> ~TensorType
273 ```
274
275 ## squeeze
276 ```python
277 Tensor.squeeze(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None) -> ~TensorType
278 ```
279
280 ## expand_dims
281 ```python
282 Tensor.expand_dims(self:~TensorType, axis:int) -> ~TensorType
283 ```
284
285 ## full
286 ```python
287 Tensor.full(self:~TensorType, shape:Union[Tuple[int, ...], int], value:float) -> ~TensorType
288 ```
289
290 ## index_update
291 ```python
292 Tensor.index_update(self:~TensorType, indices:Any, values:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
293 ```
294
295 ## arange
296 ```python
297 Tensor.arange(self:~TensorType, start:int, stop:Union[int, NoneType]=None, step:Union[int, NoneType]=None) -> ~TensorType
298 ```
299
300 ## cumsum
301 ```python
302 Tensor.cumsum(self:~TensorType, axis:Union[int, NoneType]=None) -> ~TensorType
303 ```
304
305 ## flip
306 ```python
307 Tensor.flip(self:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None) -> ~TensorType
308 ```
309
310 ## meshgrid
311 ```python
312 Tensor.meshgrid(self:~TensorType, *tensors:~TensorType, indexing:str='xy') -> Tuple[~TensorType, ...]
313 ```
314
315 ## pad
316 ```python
317 Tensor.pad(self:~TensorType, paddings:Tuple[Tuple[int, int], ...], mode:str='constant', value:float=0) -> ~TensorType
318 ```
319
320 ## isnan
321 ```python
322 Tensor.isnan(self:~TensorType) -> ~TensorType
323 ```
324
325 ## isinf
326 ```python
327 Tensor.isinf(self:~TensorType) -> ~TensorType
328 ```
329
330 ## crossentropy
331 ```python
332 Tensor.crossentropy(self:~TensorType, labels:~TensorType) -> ~TensorType
333 ```
334
335 ## T
336
337 ## abs
338 ```python
339 Tensor.abs(self:~TensorType) -> ~TensorType
340 ```
341
342 ## pow
343 ```python
344 Tensor.pow(self:~TensorType, exponent:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
345 ```
346
347 ## value_and_grad
348 ```python
349 Tensor.value_and_grad(self:~TensorType, f:Callable[..., ~TensorType], *args:Any, **kwargs:Any) -> Tuple[~TensorType, ~TensorType]
350 ```
351
352 ## value_aux_and_grad
353 ```python
354 Tensor.value_aux_and_grad(self:~TensorType, f:Callable[..., Tuple[~TensorType, Any]], *args:Any, **kwargs:Any) -> Tuple[~TensorType, Any, ~TensorType]
355 ```
356
357 ## flatten
358 ```python
359 Tensor.flatten(self:~TensorType, start:int=0, end:int=-1) -> ~TensorType
360 ```
361
362 ## l0
363 ```python
364 NormsMethods.l0(x:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
365 ```
366
367 ## l1
368 ```python
369 NormsMethods.l1(x:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
370 ```
371
372 ## l2
373 ```python
374 NormsMethods.l2(x:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
375 ```
376
377 ## linf
378 ```python
379 NormsMethods.linf(x:~TensorType, axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
380 ```
381
382 ## lp
383 ```python
384 NormsMethods.lp(x:~TensorType, p:Union[int, float], axis:Union[int, Tuple[int, ...], NoneType]=None, keepdims:bool=False) -> ~TensorType
385 ```
386
387 ## raw
388
389 ## dtype
390
391 ## __init__
392 ```python
393 Tensor.__init__(self, raw:Any)
394 ```
395
396 ## __repr__
397 ```python
398 Tensor.__repr__(self:~TensorType) -> str
399 ```
400
401 ## __format__
402 ```python
403 Tensor.__format__(self:~TensorType, format_spec:str) -> str
404 ```
405
406 ## __getitem__
407 ```python
408 Tensor.__getitem__(self:~TensorType, index:Any) -> ~TensorType
409 ```
410
411 ## __iter__
412 ```python
413 Tensor.__iter__(self:~TensorType) -> Iterator[~TensorType]
414 ```
415
416 ## __bool__
417 ```python
418 Tensor.__bool__(self:~TensorType) -> bool
419 ```
420
421 ## __len__
422 ```python
423 Tensor.__len__(self:~TensorType) -> int
424 ```
425
426 ## __abs__
427 ```python
428 Tensor.__abs__(self:~TensorType) -> ~TensorType
429 ```
430
431 ## __neg__
432 ```python
433 Tensor.__neg__(self:~TensorType) -> ~TensorType
434 ```
435
436 ## __add__
437 ```python
438 Tensor.__add__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
439 ```
440
441 ## __radd__
442 ```python
443 Tensor.__radd__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
444 ```
445
446 ## __sub__
447 ```python
448 Tensor.__sub__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
449 ```
450
451 ## __rsub__
452 ```python
453 Tensor.__rsub__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
454 ```
455
456 ## __mul__
457 ```python
458 Tensor.__mul__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
459 ```
460
461 ## __rmul__
462 ```python
463 Tensor.__rmul__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
464 ```
465
466 ## __truediv__
467 ```python
468 Tensor.__truediv__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
469 ```
470
471 ## __rtruediv__
472 ```python
473 Tensor.__rtruediv__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
474 ```
475
476 ## __floordiv__
477 ```python
478 Tensor.__floordiv__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
479 ```
480
481 ## __rfloordiv__
482 ```python
483 Tensor.__rfloordiv__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
484 ```
485
486 ## __mod__
487 ```python
488 Tensor.__mod__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
489 ```
490
491 ## __lt__
492 ```python
493 Tensor.__lt__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
494 ```
495
496 ## __le__
497 ```python
498 Tensor.__le__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
499 ```
500
501 ## __eq__
502 ```python
503 Tensor.__eq__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
504 ```
505
506 ## __ne__
507 ```python
508 Tensor.__ne__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
509 ```
510
511 ## __gt__
512 ```python
513 Tensor.__gt__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
514 ```
515
516 ## __ge__
517 ```python
518 Tensor.__ge__(self:~TensorType, other:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
519 ```
520
521 ## __pow__
522 ```python
523 Tensor.__pow__(self:~TensorType, exponent:Union[_ForwardRef('Tensor'), int, float]) -> ~TensorType
524 ```
525