Post not yet marked as solved
I'm writing a c++ program using xcode and I ran into a problem when configuring the opencv environment that almost no tutorials mention.
The installation at the beginning was as most tutorials say
brew install opencv
Then add opencv path in header search path and library path in build setting.
But after I execute it prompts:
dyld0__abort_with_payload:dyld[5059]: Library not loaded: /opt/homebrew/opt/opencv/lib/libopencv_imgcodecs.408.dylib`
solution is:
Post not yet marked as solved
with my MacBook m2.
The code works correctly both on CPU and GPU, but the speed on GPU is much slower!
I have loaded my statistic and my model on GPU, and it seemed to work.
/Users/guoyijun/Desktop/iShot_2023-08-20_09.57.41.png
I printed my code runtime. when the following function "train" is called, the loop speed among them runs extraordinarily slow.
def train(net, device, train_features, train_labels, test_features, test_labels,
num_epochs, learning_rate, weight_decay, batch_size):
train_ls, test_ls = [], []
train_iter = d2l.load_array((train_features, train_labels), batch_size, device)
# Adam
optimizer = torch.optim.Adam(net.parameters(), lr = learning_rate, weight_decay = weight_decay)
for epoch in range(num_epochs):
for X, y in train_iter:
optimizer.zero_grad()
l = loss(net(X), y)
l.backward()
optimizer.step() #
train_ls.append(log_rmse(net, train_features, train_labels))
return train_ls, test_ls
Post not yet marked as solved
my PC is Mac M2 air
my macOS version is 13.4.
I followed the way offered by apple to install TensorFlow.
I have installed anaconda(python 3.9) before, when I try to install TensorFlow-metal in the virtual environment(py3.9), the information is:
ERROR: Could not find a version that satisfies the requirement tensorflow-metal (from versions: none)
ERROR: No matching distribution found for tensorflow-metal
I tried many ways (upgrade the Anaconda) but cannot solve it.
Has anybody met the same problems?