MCPcopy
hub / github.com/tensorflow/tfjs / standardizeUserData

Method standardizeUserData

tfjs-layers/src/engine/training.ts:1186–1213  ·  view source on GitHub ↗
(
      x: Tensor|Tensor[]|{[inputName: string]: Tensor},
      y: Tensor|Tensor[]|{[inputName: string]: Tensor},
      sampleWeight?: Tensor|Tensor[]|{[outputName: string]: Tensor},
      classWeight?: ClassWeight|ClassWeight[]|ClassWeightMap,
      checkBatchAxis = true,
      batchSize?: number)

Source from the content-addressed store, hash-verified

1184 }
1185
1186 protected async standardizeUserData(
1187 x: Tensor|Tensor[]|{[inputName: string]: Tensor},
1188 y: Tensor|Tensor[]|{[inputName: string]: Tensor},
1189 sampleWeight?: Tensor|Tensor[]|{[outputName: string]: Tensor},
1190 classWeight?: ClassWeight|ClassWeight[]|ClassWeightMap,
1191 checkBatchAxis = true,
1192 batchSize?: number): Promise<[Tensor[], Tensor[], Tensor[]]> {
1193 const [standardXs, standardYs] =
1194 this.standardizeUserDataXY(x, y, checkBatchAxis, batchSize);
1195 // TODO(cais): Handle sampleWeights.
1196 if (sampleWeight != null) {
1197 throw new Error('sample weight is not supported yet.');
1198 }
1199
1200 let standardSampleWeights: Tensor[] = null;
1201 if (classWeight != null) {
1202 const classWeights =
1203 standardizeClassWeights(classWeight, this.outputNames);
1204 standardSampleWeights = [];
1205 for (let i = 0; i < classWeights.length; ++i) {
1206 standardSampleWeights.push(
1207 await standardizeWeights(standardYs[i], null, classWeights[i]));
1208 }
1209 }
1210
1211 // TODO(cais): Deal with the case of model.stateful == true.
1212 return [standardXs, standardYs, standardSampleWeights];
1213 }
1214
1215 /**
1216 * Loop over some test data in batches.

Callers 2

fitMethod · 0.95
trainOnBatchMethod · 0.95

Calls 4

standardizeUserDataXYMethod · 0.95
standardizeClassWeightsFunction · 0.90
standardizeWeightsFunction · 0.90
pushMethod · 0.45

Tested by

no test coverage detected