tfgo
tfgo copied to clipboard
SparseTensor support
as this python model example: How do i append the SparseTensor? input as (indices,values,dense_shape)
Can you please clarify your question? If you have some code to share it would be better
my model like:
from tensorflow.keras.layers import Dense, Input
from tensorflow.keras.models import Model
import scipy
import numpy as np
trainX = scipy.sparse.random(1024, 1024)
trainY = np.random.rand(1024, 2)
inputs = Input(shape=(trainX.shape[1],), sparse=True)
outputs = Dense(trainY.shape[1], activation='softmax')(inputs)
model = Model(inputs=inputs, outputs=outputs)
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
steps = 10
for i in range(steps):
# For simplicity, we directly use trainX and trainY in this example
# Usually, this is where batches are prepared
print(model.train_on_batch(trainX, trainY))
tf.saved_model.save(model, "TFKerasModel/abctest")
I load this model use golang but i don;t know how to put the feature into this model