Probably there's something wrong with the input values for X and/or T. The function from the question works ok:

import numpy as np
from math import e

def sigmoid(X, T):
  return 1.0 / (1.0 + np.exp(-1.0 * np.dot(X, T)))

X = np.array([[1, 2, 3], [5, 0, 0]])
T = np.array([[1, 2], [1, 1], [4, 4]])

print(X.dot(T))
# Just to see if values are ok
print([1. / (1. + e ** el) for el in [-5, -10, -15, -16]])
print()
print(sigmoid(X, T))

Result:

[[15 16]
 [ 5 10]]

[0.9933071490757153, 0.9999546021312976, 0.999999694097773, 0.9999998874648379]

[[ 0.99999969  0.99999989]
 [ 0.99330715  0.9999546 ]]

Probably it's the dtype of your input arrays. Changing X to:

X = np.array([[1, 2, 3], [5, 0, 0]], dtype=object)

Gives:

Traceback (most recent call last):
  File "/[...]/stackoverflow_sigmoid.py", line 24, in <module>
    print sigmoid(X, T)
  File "/[...]/stackoverflow_sigmoid.py", line 14, in sigmoid
    return 1.0 / (1.0 + np.exp(-1.0 * np.dot(X, T)))
AttributeError: exp
Answer from H.D. on Stack Overflow
🌐
Fast.ai
forums.fast.ai › part 1 (2018)
AttributeError 'float object has no attribute 'cpu' - first model - Part 1 (2018) - fast.ai Course Forums
October 9, 2018 - Followed all the setup steps, including using the fastai template in paperspace. Everything fine until I try to use the first model “Our first model: quick start”. I get: AttributeError: 'float object has no attribute ‘cpu’ No idea why this might be. I’m relatively new to python and ML.
🌐
GitHub
github.com › theislab › scarches › issues › 36
"AttributeError: 'float' object has no attribute 'cpu'" · Issue #36 · theislab/scarches
January 5, 2021 - /PHShome/ik936/anaconda3/envs/scarches3/lib/python3.6/site-packages/scarches/trainers/trvae/trainer.py in on_epoch_end(self) 266 if "loss" in key: 267 self.logs["epoch_" + key].append( --> 268 sum(self.iter_logs[key][:]).cpu().detach().numpy() / len(self.iter_logs[key][:])) 269 270 # Validate Model · AttributeError: 'float' object has no attribute 'cpu' Reactions are currently unavailable ·
Author   ilyakorsunsky
Discussions

if np.isnan(grad_norm.cpu()): AttributeError: 'float' object has no attribute 'cpu'
There was an error while loading. Please reload this page · 运行环境:天池实验室notebook gpu https://tianchi.aliyun.com/ https://dsw-dev.data.aliyun.com/ run: !python synthesizer_train.py mandarin /data/nas/workspace/jupyter/data/SV2TTS/synthesizer More on github.com
🌐 github.com
5
October 19, 2021
python - Numpy AttributeError: 'float' object has no attribute 'exp' - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
python - AttributeError: 'numpy.float64' object has no attribute 'cpu' - Stack Overflow
I am trying to run BERT and train a model using pytorch. I am not sure why I am getting this error after finishing the first Epoch. I am using this code link history = defaultdict(list) best_accura... More on stackoverflow.com
🌐 stackoverflow.com
AttributeError: 'float' object has no attribute 'detach'
I am trying to do this : my_file3 = x_mean[1].detach().cpu().numpy() and it shows me this error : AttributeError: ‘float’ object has no attribute ‘detach’ More on discuss.pytorch.org
🌐 discuss.pytorch.org
0
0
March 11, 2021
🌐
GitHub
github.com › fastai › fastai › issues › 865
'float' object has no attribute '"cpu"' · Issue #865 · fastai/fastai
October 8, 2018 - Describe the bug Run time error for fastai-v0: 'float' object has no attribute '"cpu"' in core.py to_np(v) It seems like this was caused by a recent commit: f62716c I changed the function as follows: def to_np(v): '''returns an np.array ...
Author   james-woo
🌐
GitHub
github.com › babysor › MockingBird › issues › 160
if np.isnan(grad_norm.cpu()): AttributeError: 'float' object has no attribute 'cpu' · Issue #160 · babysor/MockingBird
October 19, 2021 - Traceback (most recent call last): File "synthesizer_train.py", line 35, in train(**vars(args)) File "/data/nas/workspace/jupyter/MockingBird/synthesizer/train.py", line 200, in train if np.isnan(grad_norm.cpu()): AttributeError: 'float' object has no attribute 'cpu' No one assigned ·
Author   lcp580
🌐
Bobby Hadz
bobbyhadz.com › blog › python-attributeerror-float-object-has-no-attribute
AttributeError: 'float' object has no attribute 'X' (Python) | bobbyhadz
The Python "AttributeError: 'float' object has no attribute" occurs when we try to access an attribute that doesn't exist on a floating-point number, e.g.
Find elsewhere
🌐
PyTorch Forums
discuss.pytorch.org › t › attributeerror-float-object-has-no-attribute-detach › 114461
AttributeError: 'float' object has no attribute 'detach' - PyTorch Forums
March 11, 2021 - I am trying to do this : my_file3 = x_mean[1].detach().cpu().numpy() and it shows me this error : AttributeError: ‘float’ object has no attribute ‘detach’
🌐
GitHub
github.com › ranaroussi › yfinance › issues › 1096
AttributeError: 'float' object has no attribute 'upper' · Issue #1096 · ranaroussi/yfinance
October 19, 2022 - Any ideas on the error below? My code works fine on windows locally on my laptop, it basically pulls data for a group of 5000 stocks 1 by 1. When i try to run it onlinus most of the symbols work fi...
Author   gib-uk
🌐
Stack Overflow
stackoverflow.com › questions › 57989774 › attributeerror-numpy-float32-object-has-no-attribute-to-cpu
chainer - AttributeError: 'numpy.float32' object has no attribute 'to_cpu' - Stack Overflow
September 18, 2019 - Would you share the definition of model? It looks model(...) returns a numpy.ndarray object (not chainer.Variable), which causes the error. ... Try to use acc_data = cuda.to_cpu(acc_data).
🌐
GitHub
github.com › bryancatanzaro › copperhead › issues › 9
AttributeError: 'float' object has no attribute '__name__' · Issue #9 · bryancatanzaro/copperhead
February 23, 2013 - I use an array of numpy.float64 tuple values to compute results. However when I run it, copperhead gives me the following trace although python interpreter works perfectly: Trying to read file (" inputs/in_4.txt ") content into a list ... Now computing CPU prices ...
Author   mohdsm81
🌐
GitHub
github.com › choderalab › espaloma › issues › 130
AttributeError: 'float' object has no attribute 'value_in_unit' (and others) · Issue #130 · choderalab/espaloma
September 26, 2022 - AttributeError: 'float' object has no attribute 'value_in_unit' (and others)#130 · Copy link · mikemhenry · opened · on Sep 26, 2022 · Issue body actions · Right now CI is failing due to the new openff toolkit using a different package for units. The openff-unit package provides a way to support both using openmm.units and openff.units.
Author   mikemhenry
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-attributeerror-object-has-no-attribute
How to fix AttributeError: object has no attribute - GeeksforGeeks
July 23, 2025 - To understand this error, we first have to know how to read the error message effectively. It typically consists of two parts: "AttributeError" and "Object has no attribute." The former indicates the type of error, and the latter suggests that the attribute we are trying to access does not exist for the object.
🌐
Esri Community
community.esri.com › t5 › python-questions › attributeerror-float-object-has-no-attribute › td-p › 39532
Solved: AttributeError: 'float' object has no attribute 's... - Esri Community
December 12, 2021 - I'm hoping someone can tell me whats going on with the below bit of code. I keep getting the error AttributeError: 'float' object has no attribute 'setValue' and I'm not sure how to resolve it. Can someone please explain? NONFLOOD = "GRIDfield" NF1curs = arcpy.UpdateCursor(BuildingGridSe...
🌐
Real Python
realpython.com › ref › builtin-exceptions › attributeerror
AttributeError | Python’s Built-in Exceptions – Real Python
Every Python object will raise an AttributeError when you attempt to access a non-existent attribute on it. When you need to implement custom logic, then you can edit .__getattr__() accordingly before raising the error manually: ... >>> class CustomObject: ... def __getattr__(self, name): ... # Write to logs ... raise AttributeError(f"No '{name}' here.") ...
🌐
freeCodeCamp
forum.freecodecamp.org › python
Bug found in Data Analysis Example B Lecture File - Python - The freeCodeCamp Forum
July 7, 2022 - In the Lecture_2.ipynb example code is: df['rental_gain_return'].mean().round(2) results in: AttributeError: 'float' object has no attribute 'round' This is incorrect and should be: round(df['rental_gain_return'].mean(),2) Same with the median as well. Version of python: 3.10.5 Version of pandas: ...
🌐
Fast.ai
forums.fast.ai › intro to machine learning (2018)
'float' object has no attribute 'rint' while calling fit() - Intro to Machine Learning (2018) - fast.ai Course Forums
May 31, 2019 - When I try to run fit(net, md, n_epochs=1, crit=loss, opt=opt, metrics=metrics) it gives me the error --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) ~/anaconda3/envs/fastai-cpu/lib/python3.6/site-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds) 55 try: ---> 56 return getattr(obj, method)(*args, **kwds) 57 AttributeError: 'list' object has ...