You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 4.7 kB

5 years ago
5 years ago
5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Copyright 2020-2021 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """
  16. Numpy-like interfaces in mindspore.
  17. Examples:
  18. >>> import mindspore.numpy as np
  19. Note:
  20. - array_ops.py defines all the array operation interfaces.
  21. - array_creations.py defines all the array generation interfaces.
  22. - math_ops.py defines all the math operations on tensors.
  23. - logic_ops.py defines all the logical operations on tensors.
  24. - dtypes.py defines all the mindspore.numpy dtypes (mainly redirected from mindspore)
  25. """
  26. from .array_ops import (transpose, expand_dims, squeeze, rollaxis, swapaxes, reshape,
  27. ravel, concatenate, where, atleast_1d, atleast_2d, atleast_3d,
  28. column_stack, hstack, dstack, vstack, stack, unique, moveaxis,
  29. tile, broadcast_to, broadcast_arrays, roll, append, split, vsplit,
  30. flip, flipud, fliplr, hsplit, dsplit, take_along_axis, take, repeat)
  31. from .array_creations import copy_ as copy
  32. from .array_creations import (array, asarray, asfarray, ones, zeros, full, arange,
  33. linspace, logspace, eye, identity, empty, empty_like,
  34. ones_like, zeros_like, full_like, diagonal, tril, triu,
  35. tri, trace, meshgrid, mgrid, ogrid, diagflat,
  36. diag, diag_indices, ix_)
  37. from .dtypes import (int_, int8, int16, int32, int64, uint, uint8, uint16,
  38. uint32, uint64, float_, float16, float32, float64, bool_, inf, nan,
  39. numeric_types, PINF, NINF)
  40. from .math_ops import (mean, inner, add, subtract, multiply, divide, true_divide, power,
  41. dot, outer, tensordot, absolute, std, var, average, minimum,
  42. matmul, square, sqrt, reciprocal, log, maximum, heaviside, amax, amin,
  43. hypot, float_power, floor, ptp, deg2rad, rad2deg, count_nonzero,
  44. positive, negative, clip, floor_divide, remainder, fix, fmod, trunc,
  45. exp, expm1, cumsum)
  46. from .logic_ops import (not_equal, less_equal, less, greater_equal, greater, equal, isfinite,
  47. isnan, isinf, isposinf, isneginf, isscalar)
  48. mod = remainder
  49. fabs = absolute
  50. array_ops_module = ['transpose', 'expand_dims', 'squeeze', 'rollaxis', 'swapaxes', 'reshape',
  51. 'ravel', 'concatenate', 'where', 'atleast_1d', 'atleast_2d', 'atleast_3d',
  52. 'column_stack', 'hstack', 'dstack', 'vstack', 'stack', 'unique', 'moveaxis',
  53. 'tile', 'broadcast_to', 'broadcast_arrays', 'append', 'roll', 'split', 'vsplit',
  54. 'flip', 'flipud', 'fliplr', 'hsplit', 'dsplit', 'take_along_axis', 'take',
  55. 'repeat']
  56. array_creations_module = ['array', 'asarray', 'asfarray', 'ones', 'zeros', 'full', 'arange',
  57. 'linspace', 'logspace', 'eye', 'identity', 'empty', 'empty_like',
  58. 'ones_like', 'zeros_like', 'full_like', 'diagonal', 'tril', 'triu',
  59. 'tri', 'trace', 'meshgrid', 'mgrid', 'ogrid', 'diagflat', 'diag',
  60. 'diag_indices', 'ix_', 'cumsum']
  61. math_module = ['mean', 'inner', 'add', 'subtract', 'multiply', 'divide', 'true_divide', 'power',
  62. 'dot', 'outer', 'tensordot', 'absolute', 'std', 'var', 'average', 'not_equal',
  63. 'minimum', 'matmul', 'square', 'sqrt', 'reciprocal', 'log', 'maximum',
  64. 'heaviside', 'amax', 'amin', 'hypot', 'float_power', 'floor', 'ptp', 'deg2rad',
  65. 'rad2deg', 'count_nonzero', 'positive', 'negative', 'clip', 'floor_divide',
  66. 'remainder', 'mod', 'fix', 'fmod', 'trunc', 'exp', 'expm1', 'fabs', 'cumsum']
  67. logic_module = ['not_equal', 'less_equal', 'less', 'greater_equal', 'greater', 'equal', 'isfinite',
  68. 'isnan', 'isinf', 'isposinf', 'isneginf', 'isscalar']
  69. __all__ = array_ops_module + array_creations_module + math_module + logic_module + numeric_types
  70. __all__.sort()