Is there a reason why an X86MinorCPU was not included with the recent change to CPU models?
Is there anything wrong with just adding it to X86CPU.py ?
from m5.objects.BaseMinorCPU import BaseMinorCPU
class X86MinorCPU(BaseMinorCPU, X86CPU):
mmu = X86MMU()
Related
I'm quite new to Python so please have me excused if this question contain some newbie misunderstandings, but I've failed to google the answer for this:
On my personal laptop running Python 3.9.7 on Windows 11 this code is working without errors.
from dataclasses import dataclass, field
#dataclass
class SomeDataClass:
somelist: list[str] = field(default_factory=lambda:['foo', 'bar'])
if __name__ == '__main__':
instance = SomeDataClass()
print(instance)
But when at work running Python 3.8.5 on Windows 10 I get the following error:
File "c:\...\test_dataclass.py", line 13, in SomeDataClass
somelist: list[str] = field(default_factory=lambda:['foo', 'bar'])
TypeError: 'type' object is not subscriptable
I'd like to understand why this behaves differently and what I could do to make it work.
I would expect dataclasses to behave similarly on both computers.
You have already intuited the reason: this is a new feature in version 3.9. You can see it in the What's New article for 3.9 here.
This feature is available in version 3.8 as well, but it is not enabled by default. You can enable it in your code by including this import:
from __future__ import annotations
There are pysc2(https://github.com/deepmind/pysc2) & Tensorflow(1.x) and OpenAI-Baselines(https://github.com/openai/baselines), like the following
https://github.com/chris-chris/pysc2-examples
https://github.com/llSourcell/A-Guide-to-DeepMinds-StarCraft-AI-Environment
The TF team has recently come up with a RL implementations(alternative to OpenAi-Baselines) called TF-Agents (https://github.com/tensorflow/agents).
Examples :
https://github.com/tensorflow/agents/blob/master/docs/tutorials/1_dqn_tutorial.ipynb
https://github.com/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_12_05_apply_rl.ipynb
https://github.com/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_12_04_atari.ipynb
For TF-Agents, you do
env_name = 'CartPole-v0'
train_py_env = suite_gym.load(env_name)
eval_py_env = suite_gym.load(env_name)
q_net = q_network.QNetwork(
train_env.observation_spec(),
train_env.action_spec(),
fc_layer_params=fc_layer_params)
optimizer = tf.compat.v1.train.AdamOptimizer(learning_rate=learning_rate)
agent = dqn_agent.DqnAgent(
train_env.time_step_spec(),
train_env.action_spec(),
q_network=q_net,
optimizer=optimizer,
td_errors_loss_fn=common.element_wise_squared_loss,
train_step_counter=train_step_counter)
agent.initialize()
For pysc2,
from pysc2.env import environment
from pysc2.env import sc2_env
from pysc2.lib import actions
from pysc2.lib import actions as sc2_actions
from pysc2.lib import features
mineral_env = sc2_env.SC2Env(
map_name="CollectMineralShards",
step_mul=step_mul,
agent_interface_format=AGENT_INTERFACE_FORMAT,
visualize=True)
How do I combine TF-Agents and Pysc2 together?
They are both Google products.
I've recently stumbled on a very similar situation where I wanted to use the hanabi-learning-environment developed by DeepMind with TF-Agents. I'm afraid I have to tell that there is no nice solution to this.
What you must do is fork the DeepMind repo and modify the environment wrapper to be compatible with what TF-Agents requires. It's gonna be quite some work to do especially if you are not familiar with how environments are defined in TF-Agents, but this is definetly something that can be done in about a week of work.
If you want to get an idea of what I did you can look at the original rl_env.py code in the Hanabi repo from DeepMind, and what I modified it into in my repo
I have no idea why DeepMind stick to their structure instead of making their code more compatible, but this is how it is.
When to use mxnet-cu101mkl = {version = "==1.5.0",sys_platform = "== 'linux'"}, I get error that I cannot longer import ndarray or nd:
ImportError: cannot import name 'ndarray'
I have no problem with this when using the same code with mxnet-cu101 (no mkl).
Is this just a bug or is this subpackage no longer supported?
I can confirm that mxnet-cu100mkl works fine (version 1.5.0). Very slight CUDA version difference to yours but the package shouldn't change. I think you might be importing a different mxnet here, possibly a folder called mxnet for example. Check the following:
import mxnet as mx
print(mx.__file__)
It should show the path to mxnet within site-packages for you Python environment. e.g.
/home/ec2-user/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/__init__.py
System information
custom code: no, it is the one in https://www.tensorflow.org/get_started/estimator
system: Apple
OS: Mac OsX 10.13
TensorFlow version: 1.3.0
Python version: 3.6.3
GPU model: AMD FirePro D700 (actually, two such GPUs)
Describe the problem
Dear all,
I am running the simple iris program:
https://www.tensorflow.org/get_started/estimator
under python 3.6.3 and tensorflow 1.3.0.
The program executes correctly, apart from the very last part, i.e. the one related to the confusion matrix.
In fact, the result I get for the confusion matrix is:
New Samples, Class Predictions: [array([b'1'], dtype=object), array([b'2'], dtype=object)]
rather than the expected output:
New Samples, Class Predictions: [1 2]
Has anything about confusion matrix changed in the latest release?
If so, how should I modify that part of the code?
Thank you very much for your help!
Best regards
Ivan
Source code / logs
https://www.tensorflow.org/get_started/estimator
This looks like a numpy issue. array([b'1'], dtype=object) is one way numpy represents the string '1'.
I'm trying to use PyArray_SearchSorted using NumPy's C API from Cython.
When call it like PyArray_SearchSorted(values, point, NPY_SEARCHLEFT) I get the GCC error: error: too few arguments to function call, expected 4, have 3.
On the other hand, when I call it like PyArray_SearchSorted(values, point, NPY_SEARCHLEFT, NULL), Cython supplies an error: Call with wrong number of arguments (expected 3, got 4).
Looking more closely, it appears there is a discrepancy between the function signature as currently defined in NumPy and as defined in Cython's includes.
I know the sorter argument for searchsorted only appeared in NumPy 1.7.0, but isn't backwards compatibility one of the guarantees with the NumPy C API? Or is this just a Cython bug?
In case it matters, I'm using Cython 0.21.1, NumPy 1.9.1 and Python 2.7 from conda on OS X.
It looks like this change occurred between release 1.6 and 1.7, in this commit:
https://github.com/numpy/numpy/commit/313fe46046a7192cbdba2e679a104777301bc7cf#diff-70664f05e46e0882b0ebe8914bea85b4L1611
I believe this is definitely a bug, but unfortunately this particular kind of bug can easily slip in even with a high standard of diligence. Something like a rigorous ABI conformance test suite would be needed to catch these consistently.