Python numpy.issctype() Examples
The following are 7 code examples for showing how to use numpy.issctype(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
numpy
, or try the search function
.
Example 1
Project: recruit Author: Frank-qlu File: test_numerictypes.py License: Apache License 2.0 | 5 votes |
def test_issctype(rep, expected): # ensure proper identification of scalar # data-types by issctype() actual = np.issctype(rep) assert_equal(actual, expected)
Example 2
Project: Mastering-Elasticsearch-7.0 Author: PacktPublishing File: test_numerictypes.py License: MIT License | 5 votes |
def test_issctype(rep, expected): # ensure proper identification of scalar # data-types by issctype() actual = np.issctype(rep) assert_equal(actual, expected)
Example 3
Project: predictive-maintenance-using-machine-learning Author: awslabs File: test_numerictypes.py License: Apache License 2.0 | 5 votes |
def test_issctype(rep, expected): # ensure proper identification of scalar # data-types by issctype() actual = np.issctype(rep) assert_equal(actual, expected)
Example 4
Project: coremltools Author: apple File: symbolic.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
def num_symbolic(val): """ Return the number of symbols in val """ if is_symbolic(val): return 1 elif isinstance(val, np.ndarray) and np.issctype(val.dtype): return 0 elif hasattr(val, "__iter__"): return sum(any_symbolic(i) for i in val) return 0
Example 5
Project: coremltools Author: apple File: symbolic.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
def any_symbolic(val): if is_symbolic(val): return True if isinstance(val, np.ndarray) and val.ndim == 0: return is_symbolic(val[()]) elif isinstance(val, np.ndarray) and np.issctype(val.dtype): return False elif isinstance(val, six.string_types): # string is iterable return False elif hasattr(val, "__iter__"): return any(any_symbolic(i) for i in val) return False
Example 6
Project: coremltools Author: apple File: symbolic.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
def any_variadic(val): if is_variadic(val): return True elif isinstance(val, np.ndarray) and np.issctype(val.dtype): return False elif isinstance(val, six.string_types): # string is iterable return False elif hasattr(val, "__iter__"): return any(any_variadic(i) for i in val) return False
Example 7
Project: coffeegrindsize Author: jgagneastro File: test_numerictypes.py License: MIT License | 5 votes |
def test_issctype(rep, expected): # ensure proper identification of scalar # data-types by issctype() actual = np.issctype(rep) assert_equal(actual, expected)