forked from mindspore-Ecosystem/mindspore
!48068 add necessary imports for Demo code
Merge pull request !48068 from 李林杰/code_docs_0119_fix_docs_alpha20
This commit is contained in:
commit
f9dcdba238
|
@ -800,8 +800,12 @@ def resize_nearest_neighbor(input_x, size, align_corners=False):
|
|||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
||||
Examples:
|
||||
>>> import numpy as np
|
||||
>>> import mindspore
|
||||
>>> from mindspore import Tensor, ops
|
||||
>>> input_tensor = Tensor(np.array([[[[-0.1, 0.3, 3.6], [0.4, 0.5, -3.2]]]]), mindspore.float32)
|
||||
>>> output = ops.ResizeNearestNeighbor(input_tensor, (2, 2))
|
||||
>>> size = (2, 2)
|
||||
>>> output = ops.ResizeNearestNeighbor(size=size)(input_tensor)
|
||||
>>> print(output)
|
||||
[[[[-0.1 0.3]
|
||||
[ 0.4 0.5]]]]
|
||||
|
|
|
@ -3702,9 +3702,12 @@ class ResizeNearestNeighbor(Primitive):
|
|||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
||||
Examples:
|
||||
>>> import numpy as np
|
||||
>>> import mindspore
|
||||
>>> from mindspore import Tensor, ops
|
||||
>>> input_tensor = Tensor(np.array([[[[-0.1, 0.3, 3.6], [0.4, 0.5, -3.2]]]]), mindspore.float32)
|
||||
>>> resize = ops.ResizeNearestNeighbor((2, 2))
|
||||
>>> output = resize(input_tensor)
|
||||
>>> size = (2, 2)
|
||||
>>> output = ops.ResizeNearestNeighbor(size=size)(input_tensor)
|
||||
>>> print(output)
|
||||
[[[[-0.1 0.3]
|
||||
[ 0.4 0.5]]]]
|
||||
|
|
Loading…
Reference in New Issue