Skip to content

Commit 798bac2

Browse files
committed
update rules md with new python rules
1 parent a003de0 commit 798bac2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

RULES.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ Some are applicable for different technologies.
7676
| GCI97 | Optimize square computation (scalar vs vectorized method) | In Python, if you want to square x, you can do x*x or x**2. | |||||||| [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI97) |
7777
| GCI98 | Avoid raising Runtime Exceptions when a check is possible | You should not catch RuntimeException. They produce large objects and represent a problem in the program that should be fixed, not handled. | [Unchecked Exceptions The Controversy](https://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html) (9.3. Les classes Exception, RunTimeException et Error)[https://www.jmdoudoux.fr/java/dej/chap-exceptions.htm#exceptions-3] | 🚧 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI98) |
7878
| GCI99 | Data : Avoid CSV Format | The Parquet format is faster to write to, lighter in weight and faster to read data from. It is suitable for use cases where there would be a lot of data I/O, especially with Cloud storage. | | 🚀 | 🚀 | 🚀 || 🚀 | 🚀 | 🚀 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI99) |
79-
| GCI100 | AI : Wrap PyTorch Inference in `torch.no_grad()` | Using a PyTorch model in evaluation mode without wrapping inference in `torch.no_grad()` leads to unnecessary gradient tracking | | 🚫 | 🚫 | 🚫 | 🚧 | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI100) |
80-
| GCI101 | AI : Avoid Bias in Conv Layers Before Batch Norm | Disable bias in convolutional layers when it's followed by a batch norm layer | | 🚫 | 🚫 | 🚫 | 🚧 | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI101) |
81-
| GCI102 | AI : Use pinned memory on DataLoader when using GPU | This rule applies to PyTorch data loading, where the use of pinned memory can significantly optimize data transfer between CPU and GPU. | | 🚫 | 🚫 | 🚫 | 🚧 | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI102) |
79+
| GCI100 | AI : Wrap PyTorch Inference in `torch.no_grad()` | Using a PyTorch model in evaluation mode without wrapping inference in `torch.no_grad()` leads to unnecessary gradient tracking | | 🚫 | 🚫 | 🚫 | | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI100) |
80+
| GCI101 | AI : Avoid Bias in Conv Layers Before Batch Norm | Disable bias in convolutional layers when it's followed by a batch norm layer | | 🚫 | 🚫 | 🚫 | | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI101) |
81+
| GCI102 | AI : Use pinned memory on DataLoader when using GPU | This rule applies to PyTorch data loading, where the use of pinned memory can significantly optimize data transfer between CPU and GPU. | | 🚫 | 🚫 | 🚫 | | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI102) |
8282
| GCI103 | Don't use .items() to iterate over a dictionary when only keys or values are needed | Avoid using `.items()` if you only use the key or the value, as this creates an unnecessary tuple, leading to increased memory allocation and slower execution. | |||||||| [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI103) |
83-
| GCI104 | Data / AI : PyTorch - Create tensors directly from Torch | In PyTorch, prefer creating tensors directly using `torch.rand`, `torch.tensor`, or other Torch methods instead of converting from NumPy arrays. Avoid using `torch.tensor(np.random.rand(...))` or similar patterns when the same result can be achieved directly with PyTorch. | | 🚫 | 🚫 | 🚫 | 🚀 | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI104) |
84-
| GCI105 | Python String Concatenation | Python String Concatenation - Use Join Instead or f-Strings instead of += | | 🚫 | 🚫 | 🚫 | 🚧 | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI105) |
83+
| GCI104 | Data / AI : PyTorch - Create tensors directly from Torch | In PyTorch, prefer creating tensors directly using `torch.rand`, `torch.tensor`, or other Torch methods instead of converting from NumPy arrays. Avoid using `torch.tensor(np.random.rand(...))` or similar patterns when the same result can be achieved directly with PyTorch. | | 🚫 | 🚫 | 🚫 | | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI104) |
84+
| GCI105 | Python String Concatenation | Python String Concatenation - Use Join Instead or f-Strings instead of += | | 🚫 | 🚫 | 🚫 | | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI105) |
8585
| GCI106 | Avoid Square Root Operations In Loop | Using scalar `math.sqrt` (or `numpy.sqrt` on individual values) inside loops leads to inefficient code | | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI106) |
8686
| GCI107 | Data : Avoid Iterative Matrix Operations | Use vectorization by the usage of the built-in functions of TensorFlow, NumPy or Pandas | | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI107) |
87-
| GCI108 | Prefer Append Left | When you want to insert an element at the beginning of a list, it's better to use a deques or a double linkedlist. | |||| 🚀 |||| [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI108) |
87+
| GCI108 | Prefer Append Left | When you want to insert an element at the beginning of a list, it's better to use a deques or a double linkedlist. | |||| |||| [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI108) |
8888
| GCI203 | Detect unoptimized file formats | When it is possible, to use svg format image over other image format | | 🚧 | 🚀 | 🚀 || 🚀 | 🚀 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI203) |
8989
| GCI404 | Avoid list comprehension in iterations | Use generator comprehension instead of list comprehension in for loop declaration | | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI404) |
9090
| GCI522 | Sobriety: Brightness Override | To avoid draining the battery, iOS and Android devices adapt the brightness of the screen depending on the environment light. | | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | [documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI522) |

0 commit comments

Comments
 (0)