Tag Archives: artificial intelligence

[Solved] TVM operate error: TVMError: AssertionError

TVM operate error: TVMError: AssertionError

Traceback (most recent call last):
  File "tune_relay_x86.py", line 248, in <module>
    tune_and_evaluate(tuning_option)
  File "tune_relay_x86.py", line 241, in tune_and_evaluate
    lib = relay.build_module.build(mod, target=target, params=params)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/relay/build_module.py", line 468, in build
    graph_json, runtime_mod, params = bld_mod.build(
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/relay/build_module.py", line 196, in build
    self._build(mod, target, target_host, executor, runtime, workspace_memory_pools, mod_name)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
    raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
  30: TVMFuncCall
  29: tvm::relay::backend::RelayBuildModule::GetFunction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#3}::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const
  28: tvm::relay::backend::RelayBuildModule::BuildRelay(tvm::IRModule, tvm::runtime::String const&)
  27: tvm::relay::backend::RelayBuildModule::OptimizeImpl(tvm::IRModule)
  26: tvm::transform::Pass::operator()(tvm::IRModule) const
  25: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
  24: tvm::transform::SequentialNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
  23: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
  22: tvm::relay::transform::FunctionPassNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
  21: _ZN3tvm7runtime13PackedFuncObj9ExtractorINS0_16PackedFuncSubObjIZNS0_15TypedPackedFuncIFNS_5relay8FunctionES6_NS_8IRModuleENS_9transform11PassContextEEE17AssignTypedLambdaIZNS5_9transform13AlterOpLayoutEvEUlS6_S7_S9_E_EEvT_EUlRKNS0_7TVMArgsEPNS0_11TVMRetValueEE_EEE4CallEPKS1_SG_SK_
  20: tvm::relay::alter_op_layout::AlterOpLayout(tvm::RelayExpr const&)
  19: tvm::relay::ForwardRewrite(tvm::RelayExpr const&, tvm::runtime::TypedPackedFunc<tvm::RelayExpr (tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&)> const&, std::function<tvm::runtime::ObjectRef (tvm::relay::Call const&)>, std::function<tvm::RelayExpr (tvm::RelayExpr const&)>)
  18: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)
  17: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&)
  16: _ZN3tvm5relay16MixedModeMutator17DispatchVisitExprERKNS_9Re
  15: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
  14: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)
  13: _ZZN3tvm5relay11ExprFunctorIFNS_9RelayExprERKS2_EE10InitVTableEvENUlR
  12: tvm::relay::ExprMutator::VisitExpr_(tvm::relay::FunctionNode const*)
  11: tvm::relay::MixedModeMutator::VisitExpr(tvm::RelayExpr const&)
  10: tvm::relay::MixedModeMutator::VisitLeaf(tvm::RelayExpr const&)
  9: _ZN3tvm5relay16MixedModeMutator17DispatchVisitExprERKNS_9Re
  8: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
  7: tvm::relay::ExprFunctor<tvm::RelayExpr (tvm::RelayExpr const&)>::VisitExpr(tvm::RelayExpr const&)
  6: _ZZN3tvm5relay11ExprFunctorIFNS_9RelayExprERKS2_EE10InitVTableEvENUlR
  5: tvm::relay::MixedModeMutator::VisitExpr_(tvm::relay::CallNode const*)
  4: tvm::relay::ForwardRewriter::Rewrite_(tvm::relay::CallNode const*, tvm::RelayExpr const&)
  3: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::runtime::TypedPackedFunc<tvm::RelayExpr (tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&)>::AssignTypedLambda<tvm::RelayExpr (*)(tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&)>(tvm::RelayExpr (*)(tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&))::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
  2: tvm::RelayExpr tvm::relay::LayoutRewriter<tvm::relay::alter_op_layout::AlterTransformMemorizer>(tvm::relay::Call const&, tvm::runtime::Array<tvm::RelayExpr, void> const&, tvm::runtime::ObjectRef const&)
  1: tvm::relay::alter_op_layout::AlterTransformMemorizerNode::CallWithNewLayouts(tvm::relay::Call const&, tvm::Attrs, std::vector<tvm::RelayExpr, std::allocator<tvm::RelayExpr> > const&)
  0: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<TVMFuncCreateFromCFunc::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#2}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 81, in cfun
    rv = local_pyfunc(*pyargs)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/relay/op/nn/_nn.py", line 112, in alter_op_layout_dense
    return topi.nn.dense_alter_layout(attrs, inputs, tinfos, out_type)
  File "/home/lizhenxu/anaconda3/lib/python3.8/site-packages/decorator.py", line 231, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/target/generic_func.py", line 286, in dispatch_func
    return dispatch_dict[k](*args, **kwargs)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/topi/x86/dense_alter_op.py", line 51, in _alter_dense_layout
    _, outs = relay.backend.te_compiler.select_implementation(
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/relay/backend/te_compiler.py", line 201, in select_implementation
    outs = impl.compute(attrs, inputs, out_type)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/relay/op/op.py", line 126, in compute
    return _OpImplementationCompute(self, attrs, inputs, out_type)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
    raise get_last_ffi_error()
  3: TVMFuncCall
  2: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::relay::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#4}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
  1: tvm::relay::OpImplementation::Compute(tvm::Attrs const&, tvm::runtime::Array<tvm::te::Tensor, void> const&, tvm::Type const&)
  0: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<TVMFuncCreateFromCFunc::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#2}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 81, in cfun
    rv = local_pyfunc(*pyargs)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/relay/op/strategy/generic.py", line 833, in _compute_dense
    return [topi_compute(*args)]
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/autotvm/task/topi_integration.py", line 164, in wrapper
    cfg = DispatchContext.current.query(tgt, workload)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/autotvm/task/dispatcher.py", line 76, in query
    ret = self._query_inside(target, workload)
  File "/home/lizhenxu/ZJJ/tvm_0.9/tvm/python/tvm/autotvm/task/dispatcher.py", line 421, in _query_inside
    assert wkl == workload
TVMError: AssertionError

Run the official website code tune_relay_x86.py report the error above.

Solution: delete the .log file that was generated by running this code before

[Solved] Opencv Call yolov3 Error: IndexError: invalid index to scalar variable

Call the weight file of yolov3 with OpenCV to obtain the names of the three scale output layers and report an error

ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]

Error reporting
indexerror: invalid index to scalar variable

This code was a few years ago. It may be a problem with the version. Now it will report an error

Solution:
Remove [0] and modify as below:

ln = [ln[i - 1] for i in net.getUnconnectedOutLayers()]

[Solved] Milvus Error: [ERROR][SERVER][TakeToEUse milvus.has_collection to verify whether the collection exists

Error Messages:

[2022-04-25 23:07:20,681][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection xxx does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.

Solution

When deleting, you must delete the index first and then the set. If the order is reversed, an error will be reported

When creating an index, create a set first. If the order is reversed, an error will be reported

    def insert_ini(self, collection_name, vectors, ids=None, partition_tag=None):
        try:
            if self.has_collection(collection_name):
                self.client.drop_index(collection_name)
                self.client.drop_collection(collection_name)
            self.creat_collection(collection_name)
            self.create_index(collection_name)
            print('collection info: {}'.format(self.client.get_collection_info(collection_name)[1]))
            self.create_partition(collection_name, partition_tag)
            if vectors != -1:
                status, ids = self.client.insert(
                    collection_name=collection_name,
                    records=vectors,
                    ids=ids,
                    partition_tag=partition_tag)
                self.client.flush([collection_name])
                print(
                    'Insert {} entities, there are {} entities after insert data.'.
                    format(
                        len(ids), self.client.count_entities(collection_name)[1]))
                return status, ids
            else:
                return -1, ids
        except Exception as e:
            print("Milvus insert error:", e)

After finishing the whole, be sure to check the log in the background of the component to see if there are exceptions

Stand alone version

 cd /home/$USER/milvus/logs

The log is completely normal only when there is no error report

cat milvus-22-04-25-22:22-error.log

Mishards cluster version, or report an error

[2022-04-26 01:13:47,971][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error: Collection already exists and it is in delete state, please wait a second
[2022-04-26 01:13:47,975][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,978][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,981][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,985][ERROR][SERVER][OnExecute][reqsched_thread] [insert][0] Collection call_12345_prd not found
[2022-04-26 01:13:47,985][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,987][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,990][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.

Go to the corresponding node and check the log files one by one.

 	kubectl get pods

    kubectl exec -it milvus-release-mishards-767dc476bf-fxz8v -- /bin/bash

    kubectl exec -it milvus-release-readonly-6cb6c5bcd9-9m4c5 -- /bin/bash
    kubectl exec -it milvus-release-readonly-6cb6c5bcd9-mzrh6 -- /bin/bash

    kubectl exec -it milvus-release-writable-7776777fcc-dsdmv -- /bin/bash

Raspberry pie Use PCA9685() Error: [Errno 121] Remote I/O error

After I install pca9685() according to the online method, the following errors will appear in the operation.

>>> pwm = Adafruit_PCA9685.PCA9685()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'Adafruit_PCA9685' is not defined
>>> import Adafruit_PCA9685
>>> pwm = Adafruit_PCA9685.PCA9685()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PCA9685-1.0.1-py3.7.egg/Adafruit_PCA9685/PCA9685.py", line 75, in __init__
    self.set_all_pwm(0, 0)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PCA9685-1.0.1-py3.7.egg/Adafruit_PCA9685/PCA9685.py", line 111, in set_all_pwm
    self._device.write8(ALL_LED_ON_L, on & 0xFF)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_GPIO-1.0.4-py3.7.egg/Adafruit_GPIO/I2C.py", line 116, in write8
    self._bus.write_byte_data(self._address, register, value)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO-1.1.9-py3.7.egg/Adafruit_PureIO/smbus.py", line 327, in write_byte_data
OSError: [Errno 121] Remote I/O error

 

But the premise of this method is to have the Adafruit_PCA9685 file under the path /usr/local/lib/python3.7/dist-packages/”, if there is one, use the above method

My Raspberry Pi is 4B, there are three .egg files in the above path, Adafruit_PCA9685 is placed in it, as shown below

Select the middle of the Adafruit_PCA9685 .egg file, there will be PCA9685.py file, just create PCA9685.py under raspberry home/pi/ and paste the contents of the previous PCA9685.py into the newly created file, import the code to import PCA9685 instead of not import Adafruit_PCA9685

import PCA9685

Open the PCA9685 file and find that it needs to import the I2C.py file (I forgot to take a screenshot), then open the first one under the /usr/local/lib/python3.7/dist-packages/ path

Paste the contents of I2C.py and Plaform.py inside this file into a new I2C.py and Plaform.py file under home/pi, then open the PCA9685.py file in this directory and change the imported I2C in the middle position, it seems to be form Adafurit_GPIO import I2C as I2C directly to import I2C.

Then open the I2C file, found that you need to import Plaform.py, the same operation, change the previous import to import Plaform can be, as shown, and finally in the directory I2C.py PCA9685.py and Plaform.py file

You can write it directly in the raspberry pie file

import PCA9685
pwm = PCA9685.PCA9685()

See if it’s successful. I’m successful.

[Solved] mmdetection Error: ImportError: /home/user/repos/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x

Environment configuration: torch 1.11.0 + CUDA 11.3 (latest)

Use mmdetection to infer:

from mmdet.apis import init_detector, inference_detector

Errors are reported as follows:

ImportError: /home/user/repos/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail37_typeMetaDataInstance_preallocated_32E

 

The problem has been solved. The reason for the error is that the pytorch version is too new. Although openmmlab supports the latest version, it will still cause the error.

Solution:

Degrade the pytorch version to torch 1.6.0 + cu102, query the official GitHub of openmmlab, uninstall and reinstall mmcv 1.3.9, and re run the mmdetection code to solve the error.

[Solved] Error: ‘attrition‘ is not an exported object from ‘namespace:rsample‘

Error: ‘attrition’ is not an exported object from ‘namespace:rsample’


# Import package and library

# load required packages
library(rsample)
library(dplyr)
library(h2o)
library(DALEX)

# initialize h2o session
h2o.no_progress()
h2o.init()
##  Connection successful!
## 
## R is connected to the H2O cluster: 
##     H2O cluster uptime:         4 hours 30 minutes 
##     H2O cluster timezone:       America/New_York 
##     H2O data parsing timezone:  UTC 
##     H2O cluster version:        3.18.0.11 
##     H2O cluster version age:    1 month and 17 days  
##     H2O cluster name:           H2O_started_from_R_bradboehmke_gny210 
##     H2O cluster total nodes:    1 
##     H2O cluster total memory:   1.01 GB 
##     H2O cluster total cores:    4 
##     H2O cluster allowed cores:  4 
##     H2O cluster healthy:        TRUE 
##     H2O Connection ip:          localhost 
##     H2O Connection port:        54321 
##     H2O Connection proxy:       NA 
##     H2O Internal Security:      FALSE 
##     H2O API Extensions:         XGBoost, Algos, AutoML, Core V3, Core V4 
##     R Version:                  R version 3.5.0 (2018-04-23)

#Data preprocessing and processing to h2o format;

Error: ‘attrition’ is not an exported object from ‘namespace:rsample’

#

# classification data
df <- rsample::attrition %>% 
  mutate_if(is.ordered, factor, ordered = FALSE) %>%
  mutate(Attrition = recode(Attrition, "Yes" = "1", "No" = "0") %>% factor(levels = c("1", "0")))

# convert to h2o object
df.h2o <- as.h2o(df)

# create train, validation, and test splits
set.seed(123)
splits <- h2o.splitFrame(df.h2o, ratios = c(.7, .15), destination_frames = c("train","valid","test"))
names(splits) <- c("train","valid","test")

# variable names for resonse & features
y <- "Attrition"
x <- setdiff(names(df), y) 

Solution:

You can use the attrition dataset of DALEX package directly;

Remove resample:

#

# classification data
df <- attrition %>% 
  mutate_if(is.ordered, factor, ordered = FALSE) %>%
  mutate(Attrition = recode(Attrition, "Yes" = "1", "No" = "0") %>% factor(levels = c("1", "0")))

# convert to h2o object
df.h2o <- as.h2o(df)

# create train, validation, and test splits
set.seed(123)
splits <- h2o.splitFrame(df.h2o, ratios = c(.7, .15), destination_frames = c("train","valid","test"))
names(splits) <- c("train","valid","test")

# variable names for resonse & features
y <- "Attrition"
x <- setdiff(names(df), y) 

Full Error Messages:

> # classification data
> df <- rsample::attrition %>% 
+     mutate_if(is.ordered, factor, ordered = FALSE) %>%
+     mutate(Attrition = recode(Attrition, "Yes" = "1", "No" = "0") %>% factor(levels = c("1", "0")))
Error: 'attrition' is not an exported object from 'namespace:rsample'
>

[Solved] size_from_dim: Assertion `dim >= 0 && (size_t)dim < sizes_.size()` failed.

Problems encountered

/home/optimizer-master/third_party/onnx_common/tensor.h:117: size_from_dim: Assertion dim >= 0 && (size_t)dim < sizes_.size() failed.

 

Problem description

When import onnx, I encountered the above problems

 

Solution:

If there is an op operation that cannot be exported during onnx export, this error will be reported
How to Solve:
find the operation that cannot be exported and add a judgment. If you export onnx, the op will not be used. An example is as follows

def forward(self, x):
    if torch.onnx.is_in_onnx_export():# if onnx
        return x * self.act(x)/6
    else: # normally
        return x * self.act(x + 3)/6

Vitis-AI Generate a Quantitative Model: NotImplementedError

Vitis AI reports an error when generating a quantitative model

Traceback (most recent call last):
  File "generate_model.py", line 191, in <module>
    run_main()
  File "generate_model.py", line 185, in run_main
    quantize(args.build_dir,args.quant_mode,args.batchsize)
  File "generate_model.py", line 160, in quantize
    quantizer = torch_quantizer(quant_mode, new_model, (rand_in), output_dir=quant_model)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/pytorch_nndct/apis.py", line 77, in __init__
    custom_quant_ops = custom_quant_ops)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/pytorch_nndct/qproc/base.py", line 122, in __init__
    device=device)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/pytorch_nndct/qproc/utils.py", line 175, in prepare_quantizable_module
    graph = parse_module(module, input_args)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/pytorch_nndct/qproc/utils.py", line 78, in parse_module
    module, input_args)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/pytorch_nndct/parse/parser.py", line 68, in __call__
    raw_graph, raw_params = graph_handler.build_torch_graph(graph_name, module, input_args)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/pytorch_nndct/parse/trace_helper.py", line 37, in build_torch_graph
    fw_graph, params = self._trace_graph_from_model(input_args, train)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/pytorch_nndct/parse/trace_helper.py", line 61, in _trace_graph_from_model
    train)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/pytorch_nndct/utils/jit_utils.py", line 235, in trace_and_get_graph_from_model
    graph, torch_out = _get_trace_graph()(model, args)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 277, in _get_trace_graph
    outs = ONNXTracedModule(f, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 360, in forward
    self._force_outplace,
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/torch/jit/__init__.py", line 347, in wrapper
    outs.append(self.inner(*trace_inputs))
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 530, in __call__
    result = self._slow_forward(*input, **kwargs)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 516, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 96, in forward
    raise NotImplementedError
NotImplementedError

The possible reasons for the above problems are:
no forward implementation is added to the model

[Solved] error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows,

Error return

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.3) /home/chen/Downloads/opencv-3.4.3/modules/highgui/src/window.cpp
  :632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library 
  with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install 
  libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 
  'cvShowImage'

Aborted (core dumped)

Error resolution

Execute the command according to the solution given by the system

sudo apt-get install libgtk2.0-dev
sudo apt-get install pkg-config

It doesn’t solve the problem

Cause of problem

The problem is that there is a problem with the compilation configuration when installing opencv
I execute cmake…
and the correct command is

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..

Solution:

Locate the folder where opencv is installed

cd /home/chen/Downloads/opencv-3.4.3
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
sudo make
sudo make install 

Problem-solving…

[Solved] R Language Error: Discrete value supplied to continuous scale

Error: discrete value supplied to continuous scale

#Simulation data

set.seed(123)
my_df1 <- data.frame(a=rnorm(100), b=runif(100), c=rep(1:10, 10))
my_df2 <- data.frame(a=rnorm(100), b=runif(100), c=factor(rep(LETTERS[1:5], 20)))

#Error: Discrete value supplied to continuous scale

ggplot() +
  geom_point(data=my_df1, aes(x=a, y=b, color=c)) +
  geom_polygon(data=my_df2, aes(x=a, y=b, color=c), alpha=0.5)

#Solution:

Use the fill parameter;

ggplot() +
  geom_point(data=my_df1, aes(x=a, y=b, color=c)) +
  geom_polygon(data=my_df2, aes(x=a, y=b, fill=c), alpha=0.5)

Cmake Compile opencv error: The system is: Windows – 10.0.19042 – AMD64 (Log File)

After clicking configure, an error will be reported by default. Check the log file:

The system is: Windows - 10.0.19042 - AMD64

Reason: the compiler is not selected correctly. You should select the one installed on your computer. For example, the 2019 version I installed is changed to 2019.

Solution: click file->delete cache to reselect the compiler.

RuntimeError: No HIP GPUs are available [How to Solve]

Error reason:

The code uses GPU accelerated torch, but I downloaded the C + + version of torch. Use PIP list to find packages as follows:

 

Solution:

Uninstall torch and torchvision, and then use command pip install torch==1.7.0+cu110 torchvision==0.8.0+cu110 torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html to install it.