Undefined symbol: When I try to check if my custom operator is registered or not

I have implemented custom conv2d function in c++ and I want to test it with pytorch model. I registered my custom operator but when I try to check if my operator is registered correctly or not, I am getting this error: undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb

I am using this python code in order to check if my operator is registered correctly:

import torch
import sys

def get_registered_operators():
    operators = []
    for op_name in dir(torch.ops):
        if op_name.startswith("__") and op_name.endswith("__"):
    return operators

def is_operator_registered(operator_name):
    return hasattr(torch.ops, operator_name)

if __name__ == "__main__":
    # Load the custom operator library
    shared_library_path = '/path/to/libcustom_direct_conv2d_op.so'
    except OSError as e:
        print(f"Error loading library: {e}")

    # Check if your custom operator is registered
    custom_op_name = "bsc_direct_conv2d"
    if is_operator_registered(custom_op_name):
        print(f"{custom_op_name} is registered.")
        print(f"{custom_op_name} is NOT registered.")

    # Get all the registered operators
    registered_operators = get_registered_operators()
    print("\nRegistered operators:")
    for operator_name in registered_operators:

When I run this I got this error:
Undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb
If you can help me about this I would be glad. Thanks in advance!

I have the exact same Problem with the same undefined symbol. Have you solved this already?