package com.facebook.appevents.ml; import kotlin.collections.ArraysKt___ArraysKt; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; /* loaded from: classes2.dex */ public final class MTensor { public static final Companion Companion = new Companion(null); private int capacity; private float[] data; private int[] shape; public final float[] getData() { return this.data; } public MTensor(int[] shape) { Intrinsics.checkNotNullParameter(shape, "shape"); this.shape = shape; int capacity = Companion.getCapacity(shape); this.capacity = capacity; this.data = new float[capacity]; } public final int getShapeSize() { return this.shape.length; } public final int getShape(int i) { return this.shape[i]; } public final void reshape(int[] shape) { Intrinsics.checkNotNullParameter(shape, "shape"); this.shape = shape; int capacity = Companion.getCapacity(shape); float[] fArr = new float[capacity]; System.arraycopy(this.data, 0, fArr, 0, Math.min(this.capacity, capacity)); this.data = fArr; this.capacity = capacity; } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } /* JADX INFO: Access modifiers changed from: private */ public final int getCapacity(int[] iArr) { int lastIndex; if (iArr.length == 0) { throw new UnsupportedOperationException("Empty array can't be reduced."); } int i = iArr[0]; lastIndex = ArraysKt___ArraysKt.getLastIndex(iArr); int i2 = 1; if (1 <= lastIndex) { while (true) { i *= iArr[i2]; if (i2 == lastIndex) { break; } i2++; } } return i; } } }