Skip to content

change np.ones patterns to np.full #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2021
Merged

change np.ones patterns to np.full #168

merged 2 commits into from
Jul 15, 2021

Conversation

shlff
Copy link
Member

@shlff shlff commented Jul 11, 2021

Good morning @jstac and @oyamad , this PR fix #165 by replacing all np.ones patterns with np.full in lecture-python.myst, suggested by @oyamad .

@jstac
Copy link
Contributor

jstac commented Jul 11, 2021

Hi @mmcky , would you mind to review this? I'm not sure why the build is failing.

@mmcky
Copy link
Contributor

mmcky commented Jul 11, 2021

@jstac the lecture career.md is failing during the execution tests. I will take a look this afternoon but one of the changes to the code must not be working properly.

@mmcky
Copy link
Contributor

mmcky commented Jul 11, 2021

@shlff there seems to be an issue with njit in the career lecture. I don't have time this afternoon to fix this and I will be travelling tomorrow. Would you mind to look into this?

career.ipynb.zip

---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
<ipython-input-7-a1d4eb67d899> in <module>
      1 cw = CareerWorkerProblem()
      2 T, get_greedy = operator_factory(cw)
----> 3 v_star = solve_model(cw, verbose=False)
      4 greedy_star = get_greedy(v_star)
      5 

<ipython-input-6-aefaf00ce40e> in solve_model(cw, use_parallel, tol, max_iter, verbose, print_skip)
     14 
     15     while i < max_iter and error > tol:
---> 16         v_new = T(v)
     17         error = np.max(np.abs(v - v_new))
     18         i += 1

~/anaconda3/envs/quantecon/lib/python3.8/site-packages/numba/core/dispatcher.py in _compile_for_args(self, *args, **kws)
    413                 e.patch_message(msg)
    414 
--> 415             error_rewrite(e, 'typing')
    416         except errors.UnsupportedError as e:
    417             # Something unsupported is present in the user code, add help info

~/anaconda3/envs/quantecon/lib/python3.8/site-packages/numba/core/dispatcher.py in error_rewrite(e, issue_type)
    356                 raise e
    357             else:
--> 358                 reraise(type(e), e, None)
    359 
    360         argtypes = []

~/anaconda3/envs/quantecon/lib/python3.8/site-packages/numba/core/utils.py in reraise(tp, value, tb)
     78         value = tp()
     79     if value.__traceback__ is not tb:
---> 80         raise value.with_traceback(tb)
     81     raise value
     82 

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function matmul>) found for signature:
 
 >>> matmul(array(float64, 1d, C), array(int64, 2d, C))
 
There are 2 candidate implementations:
  - Of which 2 did not match due to:
  Overload in function 'MatMul.generic': File: numba/core/typing/npydecl.py: Line 987.
    With argument(s): '(array(float64, 1d, C), array(int64, 2d, C))':
   Rejected as the implementation raised a specific error:
     TypingError: '@' arguments must all have the same dtype
  raised from /Users/matthewmckay/anaconda3/envs/quantecon/lib/python3.8/site-packages/numba/core/typing/npydecl.py:932

During: typing of intrinsic-call at <ipython-input-5-491a1abd86c9> (24)

File "<ipython-input-5-491a1abd86c9>", line 24:
    def T(v):
        <source elided>
                v2 = θ[i] + G_mean + β * v[i, :] @ G_probs        # New job
                v3 = G_mean + F_mean + β * F_probs @ v @ G_probs  # New life

Co-authored-by: Daisuke Oyama <[email protected]>
@github-actions github-actions bot temporarily deployed to commit July 11, 2021 03:23 Inactive
@mmcky
Copy link
Contributor

mmcky commented Jul 11, 2021

nice work @oyamad. @jstac @shlff this is now building with all lectures executing.

@mmcky mmcky self-requested a review July 14, 2021 23:52
Copy link
Contributor

@mmcky mmcky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks to @oyamad suggested the lectures are now executing.

cc @jstac

@jstac
Copy link
Contributor

jstac commented Jul 15, 2021

Thanks all, much appreciated.

@jstac jstac merged commit 6e7ff58 into main Jul 15, 2021
@jstac jstac deleted the modify_patterns branch July 15, 2021 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use np.full?
4 participants