Problem Description:
When python is using a custom sigmoid function, input X as a matrix, there will be a situation where’Float’ object has no attribute’exp’.
def sigmoid(inp):
return 1.0/(1 + np.exp(-inp))
It is found that it is no problem to manually generate the matrix data into this function, and then find it by looking up the numpy.mat function
numpy.mat(data, dtype=None)[source]
Interpret the input as a matrix.
Unlike matrix, asmatrix does not make a copy if the input is already a matrix or an ndarray. Equivalent to matrix(data, copy=False).
Parameters:
data: array_like
Input data.
dtype: data-type
Data-type of the output matrix.
Returns:
mat: matrix
data interpreted as a matrix.
The default dtype is None, so when the matrix is generated, the dtype is added to the type to solve the problem. For example, Xmat = numpy.mat(_x, dtype=float), and then Xmat was brought into the sigmoid function, no problem was found.
AttributeError: 'Float' object has no attribute 'exp'
Read More:
- [Solved] AttributeError: ‘depthai.node.ObjectTracker‘ object has no attribute ‘setTrackerIdAssigmentPolicy‘
- [Solved] AttributeError: ‘openvino.inference_engine.ie_api.IENetwork‘ object has no attribute ‘input_info‘
- [Solved] redis Error: AttributeError: ‘list‘ object has no attribute ‘decode‘
- Peewee insert data error:’buffer’ object has no attribute’translate’
- Pyqt5 Error: AttributeError: ‘QWidget‘ object has no attribute ‘setCentralWidget‘
- PySpark error: AttributeError: ‘NoneType‘ object has no attribute ‘_jvm‘
- ROS package executes rosrun error: attributeerror: ‘thread’ object has no attribute ‘isalive‘
- [Solved] AttributeError : ‘GridSearchCV‘ object has no attribute ‘grid_scores_‘
- [Solved] AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
- Yolox_s.pth Convert to tensorRT Error: AttributeError: ‘tensorrt.tensorrt.Builder‘ object has no attribute ‘max_workspace_size‘
- [Solved] OpenCV Error: AttributeError: module ‘cv2‘ has no attribute ‘data‘
- [Jeston Xavier NX Compile librealsense Error] AttributeError: module ‘pyrealsense2‘ has no attribute ‘pipeline‘
- [Solved] AttributeError: module ‘keras.preprocessing.image‘ has no attribute ‘load_img‘
- module ‘networkx’ has no attribute ‘from_pandas_dataframe’
- Pytorch error: `module ‘torch‘ has no attribute ‘__version___‘`
- [How to Solve] Tesorflow: module ‘pandas.core.computation’ has no attribute ‘expressions’
- [Solved] Module ‘scipy.misc‘ has no attribute ‘imread‘
- TensorFlow error: AttributeError: module ‘tensorflow_core._api.v2.train’ has no attribute ‘Optimizer‘
- Attributeerror encountered when using ceilometer and gnocchi to execute commands related to gnocchi metric list: _Environ instance has no attribute ‘
- [Solved] Runtimeerror during dcgan training: found dtype long but expected float