MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / element_size

Method element_size

python/paddle/base/framework.py:2268–2298  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 14

count_bytesFunction · 0.45
make_2d_tma_descFunction · 0.45
make_2d_tma_d_descFunction · 0.45
make_2d_tma_scales_descFunction · 0.45
__cuda_array_interface__Function · 0.45
itemsizeFunction · 0.45
itemsizeFunction · 0.45
test_element_sizeMethod · 0.45
setUpMethod · 0.45
setUpMethod · 0.45

Calls

no outgoing calls

Tested by 6

test_element_sizeMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
test_element_sizeMethod · 0.36