A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| % python test-tensor-printout-differ.py | |
| ==================== ALL INT DTYPES ===================================== | |
| Eager [1-D] type:torch.uint8 | |
| tensor([0, 0, 0], dtype=torch.uint8) | |
| TorchScript [1-D] type:torch.uint8 | |
| tensor([0, 0, 0]) | |
| [ CPUByteType{3} ] | |
| TorchScript time for (1-D) -> torch.uint8: (0.05977s)! | |
| ----------- |
| import torch | |
| from typing import Any | |
| def f(a : Any): | |
| print(a) | |
| return (isinstance(a, torch.Tensor)) | |
| m = torch.jit.script(f) | |
| def pr(ts): |
| BEFORE CODE CHANGES | |
| ==================================== | |
| TorchScript one_d time for torch.uint8: (0.00162s)! | |
| TorchScript two_d time for torch.uint8: (0.00019s)! | |
| TorchScript three_d time for torch.uint8: (0.00024s)! | |
| TorchScript four_d time for torch.uint8: (0.00071s)! |
| Eager: | |
| ===== | |
| one_d: | |
| tensor([3, 3, 0], dtype=torch.uint8) | |
| TorchScript: | |
| ===== | |
| one_d: | |
| tensor([ 3, 3, 0]) | |
| [ CPUByteType{3} ] |
| """ | |
| (c) 2014 miraculixx at gmx.ch | |
| """ | |
| from shrutil.dictobj import DictObject | |
| class RuleContext(DictObject): | |
| """ | |
| rule context to store values and attributes (or any object) | |
| """ | |
| def __init__(self): |
| import {observable, autorun} from 'mobx'; | |
| import axios from 'axios'; | |
| import Post from '../models/postModel'; // TODO!! | |
| export default class BaseStore { | |
| @observable models = []; | |
| @observable isLoading = true; | |
| constructor(type, url) { | |
| this.type = type; |