Returns the size in bytes of an element in the Tensor. Examples: .. code-block:: pycon >>> import paddle >>> paddle.enable_static() >>> x = paddle.static.data(name='x1', shape=[3, 2], dtype='bool') >>> pr
(self)
| 2266 | __repr__ = __str__ |
| 2267 | |
| 2268 | def element_size(self): |
| 2269 | """ |
| 2270 | Returns the size in bytes of an element in the Tensor. |
| 2271 | |
| 2272 | Examples: |
| 2273 | .. code-block:: pycon |
| 2274 | |
| 2275 | >>> import paddle |
| 2276 | >>> paddle.enable_static() |
| 2277 | |
| 2278 | >>> x = paddle.static.data(name='x1', shape=[3, 2], dtype='bool') |
| 2279 | >>> print(x.element_size()) |
| 2280 | 1 |
| 2281 | |
| 2282 | >>> x = paddle.static.data(name='x2', shape=[3, 2], dtype='int16') |
| 2283 | >>> print(x.element_size()) |
| 2284 | 2 |
| 2285 | |
| 2286 | >>> x = paddle.static.data(name='x3', shape=[3, 2], dtype='float16') |
| 2287 | >>> print(x.element_size()) |
| 2288 | 2 |
| 2289 | |
| 2290 | >>> x = paddle.static.data(name='x4', shape=[3, 2], dtype='float32') |
| 2291 | >>> print(x.element_size()) |
| 2292 | 4 |
| 2293 | |
| 2294 | >>> x = paddle.static.data(name='x5', shape=[3, 2], dtype='float64') |
| 2295 | >>> print(x.element_size()) |
| 2296 | 8 |
| 2297 | """ |
| 2298 | return self.desc.element_size() |
| 2299 | |
| 2300 | @property |
| 2301 | def stop_gradient(self): |
no outgoing calls