ONNXPredict Example Tensorflow Digit Recognition | Vantage BYOM - 3.0 - ONNXPredict Example: Tensorflow Digit Recognition - Teradata Vantage

Teradata Vantageā„¢ - Bring Your Own Model User Guide

Product
Teradata Vantage
Release Number
3.0
Published
May 2022
Last Update
2022-06-02
Content Type
User Guide
Publication ID
B700-1111-051K
Language
English (United States)
Some input models, such as this mnist model, require a different default naming scheme beyond a one-to-one naming of the input tensor to the input column name. The input for this mnist model requires an input tensor that is a 28x28 representation of input pixels defined by a multidimensional array. Therefore, there must be 784 columns as input for this model. Since the input of the model is a tensor named mnist_input and it is multidimensional, it looks for columns in the input table that have the following form: mnist_input_x_y where x and y in this case are the two dimensions in the data (28x28). Starting with array index 0, the default names that are looked for in the input table are: mnist_input_0_0, mnist_input_0_1, mnist_input_0_2, ..., to mnist_input_27_27. The input table, mnist, has columns with the default names, so there is no need to use the ModelInputFieldsMap in the query.
select top 10 * from mldb.ONNXPredict(
                  on mnist
    on (select * from onnx_models where model_id='mnist_tf_nn_model') DIMENSION
    using
        Accumulate('id')
 
) as td
order by id;
 
 *** Query completed. 10 rows found. 2 columns returned.
 *** Total elapsed time was 2 seconds.
id    json_report
----------- ------------------------------------------------------------------------------------------------------
	1 {"output_probability":[[2.630957E-12,7.98921E-20,3.6622763E-10,1.4614939E-8,2.8242874E-18,7.675852E-13,6.0457916E-22,1.0,7.457585E-11,1.7594398E-10]],"output_label":[7.0]}
	2 {"output_probability":[[3.6799387E-12,2.0390206E-14,1.0,3.231584E-10,1.1272038E-29,1.795237E-10,4.436691E-10,5.0364385E-30,3.739066E-12,1.11902246E-26]],"output_label":[2.0]}
	3 {"output_probability":[[3.94105E-11,0.99999654,1.6894165E-7,4.4014463E-9,3.147866E-8,2.8930609E-8,1.6643249E-6,5.7198133E-7,9.865644E-7,1.1469552E-10]],"output_label":[1.0]}
	4 {"output_probability":[[1.0,7.1109514E-14,1.3962052E-10,1.0368816E-13,5.699331E-15,1.9223096E-9,8.5772785E-11,3.0420289E-10,4.4408043E-18,1.1900066E-13]],"output_label":[0.0]}
	5 {"output_probability":[[7.739665E-11,2.0667124E-13,2.4101157E-12,5.8635945E-15,0.99995637,1.2089976E-10,4.064029E-10,4.389091E-8,1.511632E-10,4.357704E-5]],"output_label":[4.0]}
	6 {"output_probability":[[4.7587344E-14,0.9999989,1.4052956E-10,2.3602736E-10,7.3990236E-10,1.015322E-12,1.9975145E-10,1.0179564E-6,1.3055632E-8,6.1066603E-12]],"output_label":[1.0]}
	7 {"output_probability":[[2.364037E-15,5.971385E-13,8.007478E-15,3.0828535E-13,0.9999925,1.1134201E-9,9.232751E-12,1.2274212E-7,7.3868996E-6,3.576632E-8]],"output_label":[4.0]}
	8 {"output_probability":[[3.1734063E-16,9.61196E-11,5.659125E-10,1.1682748E-9,1.9956658E-6,4.59489E-10,4.6013155E-15,1.5347728E-8,3.5875936E-10,0.999998]],"output_label":[9.0]}
	9 {"output_probability":[[6.989181E-9,4.1558614E-12,1.214163E-6,1.7663672E-12,2.7223068E-4,0.93067384,0.06905197,3.144915E-13,5.718903E-9,7.452109E-7]],"output_label":[5.0]}
	10 {"output_probability":[[1.525491E-17,4.6014E-20,3.8026643E-20,5.713909E-17,3.6011816E-6,5.372409E-18,4.0764298E-19,3.9799014E-7,7.267104E-8,0.99999595]],"output_label":[9.0]}